New lint checks

I’ve gone through the code and fixed a bunch of linter complaints, some of them hiding actual bugs.

Additionally there is now a new cloud based lint check that will comment and complain on pull requests. It’s smart enough to only bring up stuff that actually is a result from the pull request, not old existing crap.

Some of the stuff it reports is really good and should be fixed directly.

There are also things we can ignore - like the errcheck in some cases, and probably others. However I’m not going to disable the checks, instead use human judgement in ignoring or fixing its suggestions. So a red mark from GolangCI shouldn’t be taken as a complete blocker, but something to note and look at as a human.

2 Likes

The “add a type to every enum” is crazy too

It’s not crazy, it’s just that you and me both don’t speak Go as well as we thought we do.

https://play.golang.org/p/AW2RHZEFvue

I guess it would be nice if Go worked the way I’d assumed it did, although it would also be a bit weird when you think about it. But it doesn’t. Which is why we need the linter. :wink:

Hopefully vet can tell you when you compare an int to an enum?

I doubt it, but anyway, either we mean for the constants to have the given type, or we don’t. It’s never intentional for the first constant to have one type and all the others to have another one I think. The inconsistency is surely a mistake.