The warning that I described is one presented by Visual Studio Code with
the vscode-go extension. Color me stupid for having simply assumed it came
from the compiler. Based on responses to this thread, I looked more
closely, and found that Mr. Wagner is correct: it's coming from golint.
I see t
It's not a compiler error, but OP is probably referring to golint.
FWIW I also prefer the `if v, err := fn(); err != nil { … }` form, in
general, but in cases like these I just write
v, err := fn()
if err != nil {
// handle error and return
}
// do thing with v
I honestly don't see a huge pro
Hi Steve,
What's the compiler error that you're seeing?
Here's a go playground example of your scenario. It doesn't seem to cause
any issues but maybe I'm misunderstanding.
https://go.dev/play/p/vvtrQTl7FSr
Regards, Stephen
On Thursday, 27 July 2023 at 16:04:19 UTC+1 Steve Roth wrote:
> The