# macos brew install golangci-lint brew upgrade golangci-lint # linux and windows # binary will be $(go env GOPATH)/bin/golangci-lint curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2
golangci-lint --version
2.源码方式安装
1 2 3 4 5
# Go 1.16+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2 # Go version < 1.16 go get -u github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
# 检测基本配置 # Options for analysis running. run: # See the dedicated "run" documentation section. option: value
# output configuration options output: # See the dedicated "output" documentation section. option: value
# 修改某个特定linter的设置 # All available settings of specific linters. linters-settings: # See the dedicated "linters-settings" documentation section. option: value
# 开启/关闭 某个linter linters: # See the dedicated "linters" documentation section. option: value
issues: # See the dedicated "issues" documentation section. option: value
severity: # See the dedicated "severity" documentation section. option: value