golangci-lint 报错

当遇到golangci-lintnotfound错误时,问题可能在于bin目录下缺少golangci-lint二进制文件或GO环境配置不正确。若是goanalysis_metalinter错误,通常是golangci-lint版本或安装问题。解决方案包括删除现有二进制文件并使用goget或goinstall重新安装最新版本。

如果报 golangci-lint not found

问题是bin目录下没有golangci-lint 这个二进制文件,或者go的环境变量没有配好

如果是Can’t run linter goanalysis_metalinter: goimports: can’t extract issues from gofmt diff output

之前被这个问题困扰了很久,同事也帮忙看了很久都没解决
其实这个是golangci-lint版本问题,或者说是没有装好,只需要去bin目录下删掉golangci-lint 的二进制文件,重新
go get -u xxx
go install xxx
问题解决

+ go version go version go1.20.5 linux/amd64 + go env -w GOPROXY=http://nexus3.msxf.com/repository/go/ warning: go env -w GOPROXY=... does not override conflicting OS environment variable + go env -w 'GONOSUMDB=*' + go env -w GO111MODULE=on + go mod tidy go: finding module for package github.com/pinpoint-apm/pinpoint-go-agent go: found github.com/pinpoint-apm/pinpoint-go-agent in github.com/pinpoint-apm/pinpoint-go-agent v1.4.7 go: finding module for package gopkg.in/tomb.v1 go: found gopkg.in/tomb.v1 in gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 + golangci-lint run --verbose --disable-all --enable=staticcheck ./... level=info msg="[config_reader] Config search paths: [./ /home/jenkins/workspace/gc-sika-deer-feature-1030-20251030142306 /home/jenkins/workspace /home/jenkins /home / /root]" level=info msg="[lintersdb] Active 1 linters: [staticcheck]" level=info msg="[loader] Go packages loading at mode 575 (compiled_files|deps|exports_file|files|imports|name|types_sizes) took 17.602293594s" level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 47.540168ms" level=info msg="Memory: 449 samples, avg is 605.4MB, max is 1306.4MB" level=info msg="Execution took 1m0.000454426s" level=info msg="[linters_context/goanalysis] analyzers took 6m7.631475432s with top 10 stages: buildir: 4m36.263962927s, nilness: 23.186807859s, typedness: 19.524630825s, fact_purity: 16.875224106s, SA5012: 15.423823616s, fact_deprecated: 13.589185124s, SA1004: 476.067183ms, SA4027: 454.686647ms, SA4000: 429.166785ms, SA9004: 421.464886ms" level=info msg="[runner] Issues before processing: 1, after processing: 0" level=info msg="[runner] Processors filtering stat (out/in): filename_unadjuster: 1/1, skip_files: 1/1, autogenerated_exclude: 0/1, skip_dirs: 1/1, cgo: 1/1, path_prettifier: 1/1" level=info msg="[runner] processing took 135.603µs with stages: autogenerated_exclude: 47.112µs, skip_dirs: 45.255µs, path_prettifier: 33.892µs, cgo: 1.686µs, nolint: 1.055µs, max_same_issues: 820ns, filename_unadjuster: 762ns, source_code: 711ns, max_from_linter: 533ns, skip_files: 499ns, diff: 436ns, exclude-rules: 428ns, fixer: 422ns, uniq_by_line: 358ns, identifier_marker: 348ns, severity-rules: 304ns, exclude: 266ns, path_shortener: 219ns, path_prefixer: 205ns, sort_results: 157ns, max_per_file_from_linter: 135ns" level=info msg="[runner] linters took 44.112152066s with stages: staticcheck: 44.111910707s" level=info msg="File cache stats: 0 entries of total size 0B" level=error msg="Timeout exceeded: try increasing it by passing --timeout option" script returned exit code 4
最新发布
10-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值