Aug 30, 2019

[Go][GopherCon 2019] linter

Reference:
https://github.com/golangci/awesome-go-linters
https://drive.google.com/file/d/1XhIshGdMMq2KxDdOIh100eYnXsQbm0fE/view



lint plugins must have:

https://github.com/golangci/golangci-lint
https://github.com/alexkohler/prealloc
https://github.com/go-critic/go-critic
https://github.com/mdempsky/maligned
https://github.com/alexkohler/nakedret
https://github.com/kyoh86/scopelint
https://staticcheck.io/docs/
https://github.com/securego/gosec
https://github.com/mgechev/revive
https://github.com/fzipp/gocyclo



tool:

https://github.com/bradleyfalzon/revgrep



git commit hooks, pre-commit:

https://github.com/golangci/golangci-lint/blob/master/.pre-commit-hooks.yaml
$ pip install pre-commit
$ pre-commit install



ways to install golangci-ling:




golangci-lint cmds:

$ golangci-lint run --fast
$ golangci-lint run --fix

integrated revgrep in golangci-lint:
$ golangci-lint run \
    --new-from-rev=$GIT_REVISION


configure golangci:

https://github.com/golangci/golangci-lint#configuration
https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
$ .golangci.yml



comment out code for not linting:

//nolint:golint,gofmt
//nolint:prealloc


Why golangci-lint is /fast/? :-)



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.