Skip to content

Go linters built on golang.org/x/tools/go/analysis

Notifications You must be signed in to change notification settings

MichaelUrman/mulint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mulint

mulint is a collection of linters I've written to handle things that have come up in code reviews, but could be automated. They're not necessarily great to apply across the board, so these are intended to help find instances that might benefit.

Many thanks to Fatih's blog article, the types tutorial and all contributors to golang.org/x/tools/go/analysis for making this possible.

Linters

  • constlit: Identify literal expressions that should be replaced by local or imported constants
  • methodlambda: Identify anonymous functions that could be replaced by method expressions

Use

Install with go get -u github.com/MichaelUrman/mulint; this should install cmd/mulint into your GOPATH/bin.

Then invoke like any other golang.org/x/tools/go/analysis checker. To run all included linters against the packages under the current directory, run mulint ./.... To run just one linter, add -lintername=False for all other linters. If you like all its recommendations, you can run with -fix to apply them. See mulint -h for details.

Troubleshooting Notes

If you see errors including could not import package C, install gcc. This appears to be a bug or limitation in golang.org/x/tools/go/analysis as of when this was originally written. Once addressed, I'm open to fixing here, but expect it would just work.

(See dominikh/go-tools#52 and golang/go#34229 for updates.)

About

Go linters built on golang.org/x/tools/go/analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages