namedreturns is a static check that finds all returns without names in Go code.
All returns must be named:
// both of return parameters do not have names.
func foo() (int, error) {
...
}
// must be
func foo() (bar int, err error) {
...
}go install github.com/masterkusok/namedreturns@latestnamedreturns [flags] [files]List of available flags now:
Flag a disables check for anonymous functions (callbacks):
func foo() {
// callback is an anonymous function, flag -a disables check for such kind of declarations
callback := func() (int, error) {
...
}
...
}Flag a disables check for function in test files. Test files are identified by
test.go suffix.