polyfloyd / go-errorlint

A source code linter that can be used to find code that will cause problems with Go's error wrapping scheme
MIT License
249 stars 19 forks source link

Detect other kinds of errorf wrapping #2

Closed coder543 closed 4 years ago

coder543 commented 4 years ago

One antipattern I was hoping this linter would catch, but it didn't:

fmt.Errorf("oh no: %s", err.Error())

Would it be practical to detect this as well?

Unrelated question, but have you tried submitting this for inclusion in golangci-lint? Your linter seems really useful!

polyfloyd commented 4 years ago

Yes, that does seem useful and is probably not too hard to add.

golangci-lint support is tracked here: https://github.com/golangci/golangci-lint/issues/1030 It's currently up to me to update the linter to the system they use