Golang Linter
gofumpt
- 替代 gofmt - 更严格
- mvdan/gofumpt
go install mvdan.cc/gofumpt@latest
gosec
go get github.com/securego/gosec/v2/cmd/gosec
cat <<CONF > gosec.conf.json
{
"global": {
"nosec": "enabled",
"audit": "enabled"
}
}
CONF
gosec -conf gosec.conf.json ./...
golangci-lint
//nolint
//nolint:golint,unused
//nolint:golint,unused // 解释说明
VER=1.50.1
# curl -LO https://github.com/golangci/golangci-lint/releases/download/v$VER/golangci-lint-$VER-darwin-amd64.tar.gz
curl -LO https://ghproxy.com/https://github.com/golangci/golangci-lint/releases/download/v$VER/golangci-lint-$VER-darwin-amd64.tar.gz
tar zxvf golangci-lint-$VER-darwin-amd64.tar.gz
mv golangci-lint-$VER-darwin-amd64/golangci-lint ~/go/bin/
- https://golangci-lint.run/usage/configuration/
- Support of generics #2649
- golangci/golangci-lint-action
- https://github.com/golangci/golangci-lint/blob/master/.golangci.yml
- https://github.com/github/git-sizer/blob/master/.golangci.toml