Go source code linter providing checks currently missing from other linters.
Project goals:
-
Provide as many useful checks as possible; We're prototyping and experimenting here.
-
When a specific check implementation is mature and proven useful, propose its integration into other linters.
-
If a good checker can't find a better home, it stays here.
We say yes! to most checks that feel right and can help someone.
You can use this tool to make whole codebase checks periodically.
There is never too much static code analysis. Try it out.
The latest documentation is available at go-critic.github.io.
go get -u github.com/go-critic/go-critic/...
Be sure gocritic
executable is under your $PATH
.
Usage of gocritic: gocritic [sub-command] [sub-command args...]
Run gocritic
without arguments to get help output.
Examples:
Command | Description |
---|---|
gocritic check-package fmt |
Runs all stable checkers on fmt package |
gocritic check-package pkg1 pkg2 |
Run all stable checkers on pkg1 and pkg2 |
gocritic check-package -enable elseif,paramName fmt |
Runs specified checkers on fmt package |
gocritic check-project $GOROOT/src |
Run all stable checkers on entire GOROOT |
gocritic check-project $GOPATH/src |
Run all stable checkers on entire GOPATH |
gocritic check-project $GOPATH/src/foo |
Run all stable checkers on all packages under GOPATH/src/foo |
Note:
check-project $GOPATH/xyz
won't work it you're using multiple paths underGOPATH
.
This project aims to be contribution-friendly.
Our chats: English or Russian (Telegram website)
We're using an optimistic merging strategy most of the time. In short, this means that if your contribution has some flaws, we can still merge it and then fix them by ourselves. Experimental and work-in-progress checkers are isolated, so nothing bad will happen.
Code style is the same as in Go project, see CodeReviewComments.
See CONTRIBUTING.md for more details. It also describes how to develop a new checker for the linter.