Skip to main content

Golang Linter

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/

revive

gocritic