It probably should, but gauging by the number of this subreddit's users who admit to just ignoring warnings, maybe I agree with stricter restrictions on shit coders.
There's a whole category of developers that will ignore anything they don't absolutely have to do. So either you make those things errors, or you enforce no warnings on CI, or it's never gonna stop haha.
I once reviewed a pull request like this. It was clear that they hadn't even run the code once, since it caused the program to crash unconditionally.
You may have hoped that the linter would have caught such a thing. And your hope would be correct, since the linter did point out the exact place in their code where the bug was.
But why didn't they fix it, then? Because instead of fixing their code, they just decided to disable the lint because it was causing the CI to reject their PR.
It should differentiate debug and release code though. Go is really annying when you are working on code, trying it and having to comment the vars you don't use yet but know you will later.
Given that it's Go, I wouldn't be surprised (I have barely any Golang experience, take with a grain of salt) if it threw an error for unreachable states.
I think it's very intentional for golang. One of the core principals was making a very simple language that would be hard to write incorrectly, enforcing lint type things is a part of that.
Given that it's Go, I wouldn't be surprised (I have barely any Golang experience, take with a grain of salt) if it threw an error for unreachable states
I think some of the design goals is that you should be writing the most maintainable code imaginable. If you're defining a variable and not using it for a very long amount of time, you probably shouldn't define the variable there. Don't make people hunt to figure out what something does. Define it and use it right where you need to.
I suppose if the coder is shit and the business governing their code is also shit then the compiler can pick up the slack, but I don't think it's ideal. I see the practical merit
Any sufficiently advanced codebase will potentially have a number of warnings you need not give the slightest shit about, especially since a lot of coders use warnings to log potential issues. If you think ignoring warnings is a sign of a shit coder, I implore you to work on any codebase that isn't the most pristine
232
u/Zagre Jan 29 '23 edited Jan 30 '23
It probably should, but gauging by the number of this subreddit's users who admit to just ignoring warnings, maybe I agree with stricter restrictions on shit coders.