[go-nuts] Re: Best Practices for Error Handling in Go APIs

2025-02-03 Thread Jeremy French
I don't know if it qualifies as "best practice" but I think it would certainly qualify as convention to put the error as the last returned value. It is also extremely common to name the error "err", though that would have little impact on API consumers as they can rename it whatever they want.

[go-nuts] Re: The possibilty run go source code as real scripts

2024-11-22 Thread Jeremy French
As a firm advocate for Go, I do not think Go is a good choice for what you're trying to do. Maybe if you wanted to just use a JIT compiler for your scripts? Since Go compiles so fast, you may not even notice the compile time for small, 500-line "scripts". Otherwise, if it has to be interprete

[go-nuts] Re: Guidance on techniques that can help me write a comprehensive test for my go library.

2024-06-06 Thread Jeremy French
This: > "I want to be able to mock every function in my library." is a bit confusing. Normally, you want to mock the functions that your library calls, not your own library functions. Other than that, this seems pretty doable.. Can you give some more clarification as to what aspect is giving you

Re: [go-nuts] Nillable basic types?

2024-03-19 Thread Jeremy French
I understand the problem you are trying to solve, and it's valid, I think. But this solutions "feels" bad and very un-Go-like. Usable zero values is a feature in Go. Whether you agree with that or not, it's a selling feature of the language and clearly something that was/is important to the Go

[go-nuts] Re: go test -coverpkg=$LIST ... failing with exit code

2024-03-13 Thread Jeremy French
I don't have any insight in trouble-shooting your exact issue, but I too would like a simple, reliable way to exclude packages from -coverpkg=./... Feels like relying on shell scripts (which is what a google search recommends) is a) fragile, and b) not particularly cross-platform. On Tuesday, M

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jeremy French
t. I was more just answering Mike Schinkel's question about why it would be useful. On Monday, March 4, 2024 at 10:47:27 AM UTC-5 Brian Candler wrote: > On Monday 4 March 2024 at 15:18:05 UTC Jeremy French wrote: > > What I find valuable is to be able to accept an enum as a paramet

Re: [go-nuts] Enums, Go1 and proposals

2024-03-04 Thread Jeremy French
What I find valuable is to be able to accept an enum as a parameter to a function, and know that it will be one of several approved values (e.g. month of the year), without having to have boiler plate to check or throw errors if it's not one of the approved values. It's checked at compile-time

[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Jeremy French
I really think the testability issue is the biggest one. Generally, testing the main package iscumbersome at least. So it's reasonable to say, "I'm not going to test the main package, but I will keep it so simple that it is impossible for a bug to exist in there." Then everything else in

Re: [go-nuts] Re: Error handling

2023-08-01 Thread Jeremy French
I don't think this argument holds much weight. I understand and agree that the majority is not always correct. But then what was the point of the developer survey, if that data is irrelevant? Isn't the existence of the developer survey an implicit statement by the Go team that they care about

[go-nuts] Re: Error handling

2023-07-30 Thread Jeremy French
Also, errors are values, which means - although uncommon - a function could return two or more error values. Which would orelse evaluate? Even if you arbitrarily chose one, that would violate the explicit vs implicit code flow principle. My sympathies, OP. I too hate the "if err!= nil" boi

Re: [go-nuts] [RFC] Yet another proposal for Go2 error handling

2023-07-02 Thread Jeremy French
Scrolling in code is bad - a necessary evil, obviously, but evil nonetheless. Vertical scrolling is bad because it causes what we were looking at to move and our eyes have to track and/or reacquire what we were looking at. It's obviously possible, but on the micro-scale it's expensive when yo

Re: [go-nuts] UML && Golang, part 2 ?

2021-07-05 Thread Jeremy French
I wouldn't think that UML is unpopular, so much as it's not as helpful as other languages. UML is especially useful in OOP, which Go is not, at least not specifically. And I also think UML can tend to push you into certain paradigms of thinking or design patterns, whereas maybe Go tends to have

Re: [go-nuts] running tests against benchmarks

2021-03-15 Thread Jeremy French
Nice! Thanks. On Mon, Mar 15, 2021 at 10:36 PM Wojciech S. Czarnecki wrote: > Dnia 2021-03-15, o godz. 10:44:50 > Jeremy French napisał(a): > > > So it seems like the logical solution would be to create a test that > runs a > > benchmark and makes sure the benchmark

Re: [go-nuts] No generic, part -2

2021-03-15 Thread Jeremy French
I was really trying not to weigh in here, mostly because it's a decision that has been decided, so there's not a lot of point in continuing the discussion, and yesterday it seemed like the thread would die, yet... it continues. For context, I was against the generics proposal, primarily because

Re: [go-nuts] running tests against benchmarks

2021-03-15 Thread Jeremy French
much if you don't have DataDog, Prometheus or Jenkins. > > -- Marcin > > On Mon, Mar 15, 2021 at 10:45 AM Jeremy French wrote: > >> I keep running into this solution to a particular problem, but when I go >> to search on how to do it, I find that not only are ther

[go-nuts] running tests against benchmarks

2021-03-15 Thread Jeremy French
I keep running into this solution to a particular problem, but when I go to search on how to do it, I find that not only are there seemingly no solutions out there in search-results-land, there doesn't seem to be anyone else even asking about it. This then leads me to suspect, that I'm going a

Re: [go-nuts] Re: Generics, please go away!

2020-12-30 Thread Jeremy French
This conversation makes me want to consider whether there's a way to solve the problem that Generics solves, but solve it in a different way. This discussion bears a lot of similarity to the argument about inheritance, and Go solved that issue rather elegantly with interfaces - describe the behavio

Re: [go-nuts] Re: Generics, please go away!

2020-12-26 Thread Jeremy French
If Java and C++ were the perfection of computer language evolution, then there would be no need for Go. Using your predecessors as the gold standard makes no sense, because if they were, then no other iteration would be necessary. We wouldn't be having this discussion, because there would be no Go.

Re: [go-nuts] Re: Generics, please go away!

2020-12-22 Thread Jeremy French
I'd like to second the notion that the argument "if you don't like them, don't use them," is an invalid argument. Anyone who's been in the game for any length of time knows that more than we'd like, we're repairing someone else's code, as opposed to writing our own from scratch. If there is a

Re: [go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-11 Thread Jeremy French
On Wednesday, November 11, 2020 at 2:09:19 AM UTC-5 axel.wa...@googlemail.com wrote: > On Wed, Nov 11, 2020 at 2:43 AM Jeremy French wrote: > >> I certainly can't speak for the whole community, but for me, the key word >> here is verbosity. I don't care (too much

Re: [go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-10 Thread Jeremy French
;value"] >> returnif !ok, errors.New("Oh no! Missing key 'value'!") >> >> Another thought: Should returnif allow a statement before the boolean >> expression like if does? >> >> returnif value, ok := myMap["value"]; !ok, errors.Ne

Re: [go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-09 Thread Jeremy French
Hm, yep. Very similar. Interestingly, the only cohesive objections I can see in those threads are to the minor details that are different from what I'm saying. Still, though - at least the idea has been presented before. Jeremy French 607-444-1725 On Mon, Nov 9, 2020, 2:57 PM Ian Lance T

[go-nuts] Proposal: New keyword returnif (resolves error handling)

2020-11-09 Thread Jeremy French
First, the caveat. I know error handling is a long-standing discussion. I know there has been lots of debate on error handling, and it can seem like there are no more new ideas to be had on the topic. And I have looked at several/most of the most popular proposals, and there are quite a few t