4 ms·
The errcheck linter is very popular for checking that you looked at every error return: https://github.com/kisielk/errcheck https://github.com/kisielk/errcheck
by nickcw 7y ago
The errcheck linter is very popular for checking that you looked at every error return: https://github.com/kisielk/errcheck https://github.com/kisielk/errcheck
I use it in most of my open source projects.
- pjmlp 7y agoAn indication that something is missing.
- derefr 7y agoNot necessarily, insofar as “Go where you always use the (result T, err error) return type” is a dialect of Go rather than Go itself. You could give this dialect a name and then maybe the compiler could enforce rules on projects that declare that they’re using that dialect (like C compilers do with dialects like “c19” vs “gnu99”), but it’s not strictly necessary; you can also just create “dialect tooling” that wraps the language’s tooling and adheres to those rules (like Elixir’s compiler wraps Erlang’s compiler.) And a CI shell-script, or git pre-commit hook, that runs a linter before/after running the compiler, is an example of just such “wrapped tooling.”