goban
is a Go(lang) linter that bans usage of user-supplied list of functions.
goban -cfg goban.cfg ./...
Config is a newline-delimited list of banned symbols. Comments start with pound symbol (#).
Examples:
# bans method `url.Query()` on type *net/url.URL
(*net/url.URL).Query
# bans `context.TODO()`
context.TODO
# or
context.TODO()
# bans first-party imports of `foo/bar`
foo/bar
If symbol has a comment on the same line - then it is printed along with the report.
fmt.Errorf # use pkg/errors instead
yields /path/to/file/foo.go:145:15: fmt.Errorf is banned - use pkg/errors instead
- Ban variables as well
- Support wildcards for rules