News for hackers. Stuff that matters.
Re:The Zen of Go by sagichmal on Sunday February 23, 2020 @08:12AM (#22396686)
I don't want to be warned, I want to be stopped, and, more importantly, I want everyone else to be stopped, too, unconditionally. -Wxxx doesn't get me there.
Re:The Zen of Go by simias on Sunday February 23, 2020 @09:18AM (#22396919)
For a little while I used to compile with -Werror but I found it very annoying. I very often want to make a quick test commenting out a function call or doing an early return that would trigger a warning for dead code and prevent me from continuing.

It might be a good idea to add it to your build bot though, this way you can enforce it for commited code. That's a good compromise IMO.

Re:The Zen of Go by apta on Sunday February 23, 2020 @09:26AM (#22396951)
You use linters to catch those issues (and more). Any quality project will have linters, CI/CD etc. set up. And it's not like golang obviates the need for linters, if anything, it needs them more than other languages to deal with several issues, including (ironically) accidentally ignoring handling errors.
Re:The Zen of Go by throwaway894345 on Sunday February 23, 2020 @11:34AM (#22397734)
Is ignoring errors really a problem in practice? I’ve been using this language since before 1.0 and I don’t think I’ve ever been burned by this. I’m sure it happens once in a while (albeit at very low frequency), but people in this thread act like you can’t build software in Go because the compiler doesn’t catch every ignored error.
Re:The Zen of Go by apta on Sunday February 23, 2020 @12:16PM (#22398039)
It gets in your way when you're debugging or writing quick scripts.
Re:The Zen of Go by iv42 on Sunday February 23, 2020 @08:45AM (#22396790)
Yes, it does: -Werror=unused-variable
Re:The Zen of Go by monktastic1 on Sunday February 23, 2020 @10:21AM (#22397197)
Presumably by "unconditional" they mean not conditioned on you using a flag.
Re:The Zen of Go by ofrzeta on Sunday February 23, 2020 @08:14AM (#22396694)
There's another switch that treats all warnings as errors and therefore bails out.
Re:The Zen of Go by snazz on Sunday February 23, 2020 @08:15AM (#22396696)
You could enforce -Werror for all debug builds, but that might be too draconian.
Re:The Zen of Go by naringas on Sunday February 23, 2020 @08:24AM (#22396722)
isn't that what go does?

after all there's no way to ignore unused variables with a compiler option

Re:The Zen of Go by jcelerier on Sunday February 23, 2020 @09:05AM (#22396858)
And that's part of the reason why some people will bever use go or other languages that add purely stylistical restrictions on you