Skip to content

Instantly share code, notes, and snippets.

@arsham
Last active April 19, 2020 16:20
Show Gist options
  • Save arsham/41517d12001a3b5f93f7c3a9870b686a to your computer and use it in GitHub Desktop.
Save arsham/41517d12001a3b5f93f7c3a9870b686a to your computer and use it in GitHub Desktop.
Go ultimate linters. #golang #linting
# Installation:
# go get -u github.com/thraxil/cyclo
# go get -u github.com/client9/misspell
# go get -u honnef.co/go/tools/cmd/staticcheck
# go get -u honnef.co/go/tools/cmd/gosimple
# go get -u honnef.co/go/tools/cmd/unused
# go get -u github.com/jgautheron/goconst/cmd/goconst
# go get -u github.com/jgautheron/usedexports
# go get -u mvdan.cc/interfacer
# go get -u github.com/tsenart/deadcode
# go get -u golang.org/x/tools/cmd/gotype
# go get -u github.com/golang/lint/golint
# go get -u github.com/kisielk/errcheck
# go get -u github.com/mdempsky/unconvert
# go get -u github.com/opennota/check/cmd/aligncheck
# go get -u github.com/opennota/check/cmd/structcheck
# go get -u github.com/opennota/check/cmd/varcheck
# go get -u github.com/arthurgustin/godepth
# to run
find . -name "*.go" -not -path "./vendor/*" -not -path ".git/*" | xargs gofmt -s -d
cyclo --max-complexity=12 $(ls -d */ | grep -v vendor)
find . -type f -not -path "./vendor/*" -not -path "./.git/*" -print0 | xargs -0 misspell
staticcheck $(glide nv)
gosimple $(glide nv)
unused $(glide nv)
goconst -ignore vendor ./...
usedexports -ignore vendor ./...
interfacer $(glide nv)
find . -type d -not -path "./vendor/*" | xargs deadcode
find . -name "*.go" -not -path "./vendor/*" -not -path ".git/*" -print0 | xargs -0 gotype
golint $(glide nv)
errcheck -ignoretests $(glide nv)
unconvert
aligncheck $(go list)
structcheck $(go list)
varcheck $(go list)
godepth -over 2 .
## gometalinter
# go get -u gopkg.in/alecthomas/gometalinter.v2
# and update-install with
# gometalinter --install --update
gometalinter -j 4 --vendor ./...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment