4 ms·
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.
by sagichmal 7y ago
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.
- ofrzeta 7y agoThere's another switch that treats all warnings as errors and therefore bails out.
- snazz 7y agoYou could enforce -Werror for all debug builds, but that might be too draconian.
- iv42 7y agoYes, it does: -Werror=unused-variable
- monktastic1 7y agoPresumably by "unconditional" they mean not conditioned on you using a flag.
- simias 7y agoFor 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.
- apta 7y agoYou 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.
- throwaway894345 7y agoIs 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.
- apta 7y agoIt gets in your way when you're debugging or writing quick scripts.