忽略规则 排除符合规则得报告 issues:exclude-rules:# Exclude some linters from running on tests files.-path:_test\.golinters:-gocyclo-errcheck-dupl-gosec# Exclude known linters from partially hard-vendored code,# which is
- yodaStyleExpr - whyNoLint - paramTypeCombine - emptyStringTest 好了,现在你应该是这样的结构了吧 项目代码目录: ├── .githooks │ ├── pre-commit │ └── pre-push ├── .golangci.yml ├── golangci-lint.sh └── init.sh 如果不是,请返回到上面在看一下步骤。 这个时候可以...
检查nolint 指令:在你的代码中,你使用了 // nolint:all 指令来忽略所有 linter 的警告。如果你希望看到某个特定 linter 的警告,你可以使用 // nolint:lintername 来忽略特定 linter 的警告,而不是所有 linter。 更新golangci-lint:确保你使用的是最新版本的 golangci-lint。旧版本的 linter 可能不包含最新的规...
nolint指令需要给出理由-- //nolint:gochecknoglobals // 原因 - nolintlint # 禁止使用Go关键字命名 - predeclared # 去掉&#...
linters-settings: errcheck: check-type-assertions: true goconst: 5 min-len: 2 6 min-occurrences: 3 gocritic: enabled-tags: - diagnostic - experimental - opinionated - performance - style gove: check-shadowing: true nolintlint: require-explanation: true require-specific: true linters: disable...
是否有方法,比如使用//nolint的一个变体来防止某些文件首先被golangci-lint分析,这样我们就不会在它们上浪费构建时资源--内存/cpu?DO NOT EDIT.这样的顶级代码行,比如/& 浏览1提问于2020-01-22得票数 8 回答已采纳 1回答 金棉在重新安装后会产生看不见的错误。 、、 go1.18.3.linux-amd64.tar.gz然后,...
//nolint:unparam package pkg 配置文件 golangci-lint 会自动在当前目录下查找以下名称的配置文件: .golangci.yml .golangci.yaml .golangci.toml .golangci.json 配置启用的代码选择器 linters: disable-all: true enable: - megacheck - govet enable-all: true disable: - maligned - prealloc...
25 - . "github.com/onsi/ginkgo/v2" //nolint:golint,revive 25 + . "github.com/onsi/ginkgo/v2" //nolint:staticcheck 26 26 ) 27 27 28 28 const ( @@ -135,6 +135,6 @@ func GetProjectDir() (string, error) { 135 135 if err != nil { 136 136 return wd, err 1...
improve nolintlint documentation Misc: cli: don't hide enable-all option october 2021 new linters: contextcheck: https://github.com/kkHAIKE/contextcheck varnamelen: https://github.com/blizzy78/varnamelen update linters: gochecknoglobals: to v0.1.0 gosec: filter issues according to th...
disable-all: trueenable:-bodyclose-deadcode-depguard-dogsled-dupl-errcheck-exportloopref-exhaustive-goconst-gocritic-gofmt-goimports-gomnd-gocyclo-gosec-gosimple-govet-ineffassign-misspell-nolintlint-nakedret-prealloc-predeclared-revive-staticcheck-structcheck-stylecheck-thelper-tparallel-typecheck-un...