Skip to content

Simple go linter that checks that all your functions have only named return parameters.

License

Notifications You must be signed in to change notification settings

masterkusok/namedreturns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

namedreturns

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) {
    ...
}

Install

go install github.com/masterkusok/namedreturns@latest

Usage

namedreturns [flags] [files]

Flags

List of available flags now:

  • a: disables check for anonymous functions.
  • t: disables check for test files.

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.

About

Simple go linter that checks that all your functions have only named return parameters.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages