Sometimes, when running golangci-lint on https://github.com/cozy/cozy-stack, I have a warning about failed_prerequisites:
WARN [runner] Can't run linter goanalysis_metalinter: fact_purity: failed prerequisites: [email protected]/cozy/cozy-stack/model/instance/lifecycle [github.com/cozy/cozy-stack/model/app.test]
Please include the following information:
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:16:56Z
Config file
$ cat .golangci.yml
cat: .golangci.yml: No such file or directory
Go environment
$ go version && go env
go version go1.13.1 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/nono/.cache/go-build"
GOENV="/home/nono/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/nono/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/nix/store/2kzdq7gyxz9jqfqcrp97z2y03vbw4glc-go-1.13.1/share/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/nix/store/2kzdq7gyxz9jqfqcrp97z2y03vbw4glc-go-1.13.1/share/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="/nix/store/7hzmz83nv8khpwsk858yaac7y3idh0a7-gcc-wrapper-8.3.0/bin/cc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/nono/cc/stack/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build302705204=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /home/nono/cc/stack /home/nono/cc /home/nono /home /]
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck]
INFO [loader] Go packages loading at mode 575 (exports_file|types_sizes|compiled_files|deps|files|imports|name) took 2.691690133s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 70.353413ms
INFO [runner/unused/goanalysis] analyzers took 5.857582585s with top 10 stages: buildssa: 4.867487779s, U1000: 990.094806ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 9.763996494s with top 10 stages: buildssa: 4.693446351s, ineffassign: 503.987592ms, vrp: 405.948511ms, inspect: 367.360506ms, varcheck: 167.809469ms, SA4018: 166.777714ms, isgenerated: 163.478578ms, deadcode: 160.6481ms, errcheck: 147.053834ms, structcheck: 142.659624ms
WARN [runner] Can't run linter goanalysis_metalinter: ctrlflow: failed prerequisites: [email protected]/cozy/cozy-stack/web/accounts [github.com/cozy/cozy-stack/web/middlewares.test]
INFO [runner] processing took 4.732µs with stages: max_same_issues: 1.074µs, skip_dirs: 500ns, cgo: 493ns, nolint: 373ns, filename_unadjuster: 361ns, max_from_linter: 303ns, exclude: 226ns, skip_files: 201ns, path_prettifier: 200ns, uniq_by_line: 170ns, identifier_marker: 154ns, max_per_file_from_linter: 140ns, diff: 138ns, path_shortener: 134ns, autogenerated_exclude: 89ns, source_code: 89ns, exclude-rules: 87ns
INFO [runner] linters took 3.157498783s with stages: unused: 1.664301241s, goanalysis_metalinter: 1.493144531s
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 60 samples, avg is 407.5MB, max is 1076.4MB
INFO Execution took 5.924849209s
I feel like this is related https://github.com/golangci/golangci-lint/issues/824
Hi I met same problem.
$golangci-lint run -v main.go
INFO [config_reader] Config search paths: [./ /home/ibmadmin/github.ibm.com/spectrum-virtualize-exporter /home/ibmadmin/github.ibm.com /home/ibmadmin /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 30 linters: [deadcode depguard dogsled dupl errcheck funlen gochecknoinits goconst gocritic gocyclo gofmt goimports golint gosec gosimple govet ineffassign interfacer lll misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (name|types_sizes|deps|exports_file|files|imports|compiled_files) took 322.014245ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 671.191µs
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 2.392766ms with top 10 stages: fact_deprecated: 458.401µs, buildssa: 114.037µs, inspect: 112.347µs, printf: 54.367µs, ctrlflow: 49.075µs, fact_purity: 43.913µs, depguard: 25.28µs, unparam: 23.584µs, S1034: 22.43µs, SA1001: 20.957µs
WARN [runner] Can't run linter goanalysis_metalinter: S1008: failed prerequisites: inspect@command-line-arguments, isgenerated@command-line-arguments
INFO [runner] processing took 6.1µs with stages: max_same_issues: 1.653µs, skip_dirs: 680ns, cgo: 596ns, nolint: 586ns, skip_files: 320ns, max_from_linter: 304ns, exclude: 278ns, filename_unadjuster: 265ns, identifier_marker: 248ns, path_prettifier: 179ns, path_shortener: 172ns, diff: 167ns, uniq_by_line: 165ns, source_code: 163ns, max_per_file_from_linter: 159ns, autogenerated_exclude: 93ns, exclude-rules: 72ns
INFO [runner] linters took 521.726734ms with stages: goanalysis_metalinter: 521.624518ms
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 10 samples, avg is 88.4MB, max is 134.8MB
INFO Execution took 880.10069ms
$go version
go version go1.12.9 linux/amd64
$ golangci-lint version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:16:56Z
i am also seeing the same issue ... any workaround will be helpful...
+1 same problem
WARN [runner] Can't run linter goanalysis_metalinter: SA2003: failed prerequisites: buildssa@command-line-arguments
➜ ~ golangci-lint version
golangci-lint has version v1.21.1-0.20191111000716-14ebae29060f built from (unknown, mod sum: "h1:J9Xwp1uY0EooAwj8OONV3bbgfAChsFdOMfFzH5eWcnQ=") on (unknown)
➜ ~ go version
go version go1.13.4 darwin/amd64
➜ ~
same error. Rerun the command then the problem go away.
confirm
amber@AmberMac Test % cat test.go
package main
func main() {
amber@AmberMac Test % golangci-lint run test.go
WARN [runner] Can't run linter goanalysis_metalinter: vrp: failed prerequisites: buildssa@command-line-arguments
WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/Users/amber/Test/test.go:4:2: expected '}', found 'EOF' /Users/amber/Test/test.go:4:2: expected '}', found 'EOF']
amber@AmberMac Test % golangci-lint version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:15:04Z
+1 same error
$ golangci-lint run --fast --out-format tab main.go
WARN [runner] Can't run linter goanalysis_metalinter: S1011: failed prerequisites: inspect@command-line-arguments, isgenerated@command-line-arguments
$ golangci-lint --version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:15:04Z
md5-6fe074871133cc996765335db9228d86
$ go version
go version go1.13.1 darwin/amd64
same here:
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:16:56
go version go1.13.4 linux/amd64
$ golangci-lint run .
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: inspect@pactado/securer
WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/home/alvarolm/dev/assets/go/src/pr/main.go:39:25: ReadFile not declared by package ioutil]
$ golangci-lint run .
WARN [runner] Can't run linter goanalysis_metalinter: SA4001: failed prerequisites: inspect@pactado/securer
WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/home/alvarolm/dev/assets/go/src/pr/main.go:39:25: ReadFile not declared by package ioutil]
+1 same problem
[WARN] golangci-lint ctrlflow: failed prerequisites
➜ ~ golangci-lint version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:15:04Z
➜ ~ go version
go version go1.13.5 darwin/amd64
This issue appears to be introduce with commit 95ec0cf.
+1
+1
+1
+1
v1.19.1 is ok for me
+1
also happens on v1.22.2
✗ golangci-lint version
golangci-lint has version 1.22.2 built from cb2f8ba on 2019-12-30T19:26:28Z
Any solution to this issue. It still keeps failing on using v1.22.2 for gitlab CI/CD.
+1 had it fail on me on version 1.22.2, same as @dvaldivia
This definitely seems like a widespread issue. Can some of you seeing the problem provide links to public repositories that can reliably reproduce the issue? Also, any links to public CI failures would be helpful as well. Having a way to reproduce the problem should make it easier to diagnose the root cause.
I'm trying to build the code first and found the code is not compilable. After fixing those uncompilable part, I don't see this problem happen again, and can report the linter messages.
# golangci-lint run
WARN [runner] Can't run linter goanalysis_metalinter: ST1016: failed prerequisites: buildssa@<package path>
# golangci-lint version
golangci-lint has version 1.21.0 built from 645e794 on 2019-10-15T18:16:56Z
# go version
go version go1.13.5 linux/amd64
We have also been seeing this intermittently. It will fail at random and the succeed on the same commit once re-run.
Oh, it is same as in #885 :(
Please use 1.19.1 or disable 'unused' linter until fix.
Sorry that it took so long to investigate this, bug is pretty flaky.
I have unused disabled, but am hitting this 100% of the time after upgrading to v1.22.2. Same issue, or worth filing another bug?
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: [email protected]/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote
ERRO Running error: assign: failed prerequisites: [email protected]/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote
Edit:
I tried v1.19.1, which ran but sucks up too much memory to be viable in our CI.
v1.21.0 runs and succeeds with acceptable memory use, but (interestingly) I still see the warning output -- it just doesn't turn into an error. /shrug/
@abscondment
It looks like same issue, but I'm not sure.
Can you please provide a way to reproduce this issue? I hope that your project is open source :(
Can you please provide a way to reproduce this issue? I hope that your project is open source :(
@ernado sadly, this one is not. If I find a concise repro, I'll share it.
(interestingly, when I run this with v1.22.2 and unused enabled, I also get a repro of #658... albeit for different method declarations)
I investigated this problem and found a solution for it: #944.
I tested with https://github.com/cozy/cozy-stack and it seems working in my local environment.
I hope it'll be reviewed soon..
+1 on the failures (ref: https://github.com/kubernetes/release/pull/1045)
I just tested #944, and it doesn't resolve the issue for my system :cry:
bribera@flask:~/code/rcom/zeke 👻 $ go version
go version go1.13.6 linux/amd64
bribera@flask:~/code/rcom/zeke 👻 $ grep 'golangci-lint ' go.mod
github.com/golangci/golangci-lint v0.0.0-20200128080200-796b4fffbe35
github.com/golangci/golangci-lint => git.taservs.net/vendor/golangci-lint v0.0.0-20200128080200-796b4fffbe35
bribera@flask:~/code/rcom/zeke 👻 $ go mod vendor
bribera@flask:~/code/rcom/zeke 👻 $ go run github.com/golangci/golangci-lint/cmd/golangci-lint version
golangci-lint has version v0.0.0-20200128080200-796b4fffbe35 built from (unknown, mod sum: "") on (unknown)
bribera@flask:~/code/rcom/zeke 👻 $ go run github.com/golangci/golangci-lint/cmd/golangci-lint run --verbose
INFO [config_reader] Config search paths: [./ /home/bribera/code/rcom/zeke /home/bribera/code/rcom /home/bribera/code /home/bribera /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 10 linters: [bodyclose deadcode gocyclo gosec gosimple govet ineffassign rowserrcheck typecheck unused]
INFO [lintersdb] Active presets: [bugs unused]
INFO [lintersdb] Active 10 linters: [bodyclose deadcode gocyclo gosec gosimple govet ineffassign rowserrcheck typecheck unused]
INFO [lintersdb] Active presets: [bugs unused]
INFO [loader] Go packages loading at mode 575 (types_sizes|compiled_files|imports|name|deps|exports_file|files) took 584.832329ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 214.630812ms
INFO [runner/unused/goanalysis] analyzers took 8.885226408s with top 10 stages: buildssa: 7.492495876s, U1000: 1.392730532s
WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/home/bribera/code/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote/soa_n_a-remote.go:233:26: NewSoaNALoginArgs not declared by package v1]
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 31.305454486s with top 10 stages: buildssa: 18.699618174s, gosec: 3.453698582s, ineffassign: 2.98840146s, inspect: 469.095499ms, deadcode: 367.683209ms, gocyclo: 267.234482ms, rowserrcheck: 203.591975ms, ctrlflow: 189.126516ms, copylocks: 163.062498ms, tests: 159.918914ms
WARN [runner] Can't run linter goanalysis_metalinter: S1002: failed prerequisites: [email protected]/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote, [email protected]/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote
INFO [runner] processing took 2.537µs with stages: max_same_issues: 376ns, nolint: 303ns, skip_dirs: 270ns, max_from_linter: 233ns, cgo: 176ns, skip_files: 134ns, identifier_marker: 134ns, diff: 133ns, filename_unadjuster: 133ns, path_prettifier: 130ns, autogenerated_exclude: 128ns, uniq_by_line: 68ns, exclude-rules: 64ns, exclude: 64ns, max_per_file_from_linter: 64ns, source_code: 64ns, path_shortener: 63ns
INFO [runner] linters took 15.467341651s with stages: goanalysis_metalinter: 9.185698917s, unused: 6.281603604s
ERRO Running error: S1002: failed prerequisites: [email protected]/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote, [email protected]/rcom/zeke/service-thrift-go/com/evidence/api/thrift/v1/soa_n_a-remote
INFO Memory: 103 samples, avg is 1701.0MB, max is 2357.0MB
INFO Execution took 16.272931532s
exit status 3
Hi, can you please try again with 1.23.2?
I think I've determined that my issue is unrelated. A directory of generated code (invalid go code generated by the thrift compiler) that our configuration is supposed to ignore is causing analysis to fail. In prior versions, it was ignored _as requested_ despite containing some invalid files. Now it is causing this error, which is accurate but unhelpful.
I'll open a ticket / search for any that might be related.
it doesn't fix it :
golangci-lint has version 1.23.3 built from 2241adf on 2020-02-04T04:58:40Z
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
ERRO Running error: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
And I'm unable to ignore that linter :-(
But I tried the verbose option, and strangely enough... this works :-)
Oh no, it is flaky again :(
ehm, mistake: other project works, the one I've got errors on , still has errors when I do the verbose option
:-( grrrrrrr
@marcelloh
Can you please remove the cache and run it again?
Something like:
rm -rf ~/.cache/golangci-lint/ && golangci-lint run --verbose
Please check that error persists and is not flaky, it is important to distinguish issues.
If it is on each run, there is probably a syntaxt error in that package.
I seem to have the same error occur on 1.12.3 from 2241adf when there's a syntax error that causes build failure in my code:
INFO [config_reader] Used config file .golangci.yaml
INFO [lintersdb] Active 12 linters: [deadcode errcheck gocritic gofmt golint gosimple govet ineffassign staticcheck structcheck typecheck unconvert]
INFO [lintersdb] Active 12 linters: [deadcode errcheck gocritic gofmt golint gosimple govet ineffassign staticcheck structcheck typecheck unconvert]
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|exports_file|files|imports|name|types_sizes) took 886.253617ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 2.70721ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 6.521049ms with top 10 stages: S1005: 1.686555ms, fact_deprecated: 669.555µs, inspect: 329.416µs, buildssa: 292.507µs, printf: 240.613µs, ctrlflow: 239.029µs, fact_purity: 159.362µs, SA4006: 116.636µs, SA6000: 93.18µs, deadcode: 92.529µs
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: inspect@<path/to/code/omitted>
INFO [runner] processing took 6.129µs with stages: max_same_issues: 2.179µs, path_prettifier: 1.896µs, skip_dirs: 306ns, max_from_linter: 266ns, filename_unadjuster: 220ns, nolint: 168ns, cgo: 159ns, autogenerated_exclude: 151ns, diff: 132ns, identifier_marker: 130ns, skip_files: 125ns, exclude: 77ns, max_per_file_from_linter: 65ns, path_shortener: 65ns, source_code: 64ns, uniq_by_line: 63ns, exclude-rules: 63ns
INFO [runner] linters took 740.838075ms with stages: goanalysis_metalinter: 740.80219ms
ERRO Running error: assign: failed prerequisites: inspect@<path/to/code/omitted>
INFO Memory: 18 samples, avg is 88.5MB, max is 137.4MB
INFO Execution took 1.641854661s
In this case the error that stopped the Go code in question building correctly was an unresolved reference.
It does seem to be caused by a different thing here, though -- inspect instead of buildssa. In light of that, would you like me to file a separate issue?
Also happy to provide more info including .golangci.yaml if that would help, as well as help patch this if I can.
I think that there is already an issue for it - we just need to print a better error in this case instead of just "failed prerequisites"
Ahh, is that https://github.com/golangci/golangci-lint/issues/886? Apologies, should've searched more carefully!
@ashleydavies I could not found it by myself, so no problem :) Yep, please track #886, will be my next priority.
Thanks very much! 😄 feel free to tag me in that issue if I can help out in any way
the cache remove didn't help :-(
But is has changed, I now have more errors:
ERRO Running error: buildssa: analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Options /Users/marcelloh/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]
ERRO Running error: interfacer: failed prerequisites: [email protected]/aanzeeonline/impact/compare
ERRO Running error: bodyclose: failed prerequisites: [email protected]/aanzeeonline/impact/compare
That's in verbose mode, and in normal mode, I only have 1 error:
WARN [runner] Can't run linter goanalysis_metalinter: ST1012: failed prerequisites: [email protected]/aanzeeonline/impact/compare
WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Optio
ns /Users/marcelloh/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]
ERRO Running error: buildssa: analysis skipped: errors in package: [/Users/marcelloh/data/go-business/impact/compare/file.go:37:19: undeclared name: Options /Users/marcelloh
/data/go-business/impact/compare/file.go:49:15: undeclared name: Exec]
if I disable govet, the error changes????
ERRO Running error: vrp: failed prerequisites: [email protected]/aanzeeonline/impact/compare
If I disable gosimple:
ERRO Running error: ST1005: failed prerequisites: [email protected]/aanzeeonline/impact/compare
disable gosec:
ERRO Running error: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
So there is something wrong here....
Yep, but package name stays the same and issue is not flaky, so it is probably just syntax error.
a syntax error ??? in my code? it compiles, so that's a no...
Oh, then I need a way to reproduce this issue :(
I will find a way to isolate the problem. I will chop off pieces until it complains about one part.
Step 1:
I move a part of the package, to another package
Result:
the error is in that newer package
Step 2:
I make comments of every line
Result:
A completely other package now has the error.
So... this is where I stop.
Perhaps the "failed prerequisites" can be much more specific, so I know where to look for. :-(
Sorry
This will be addressed in #886, sorry :(
Would be ideal for me to have a github project that fails in such way (I mean no syntax error and failed prerequisites) so I can debug, currently I can't reproduce it.
Hello @ernado we have the same issue on tektoncd
here is the log :
Here is the PR where it's come from :
https://github.com/tektoncd/pipeline/pull/2002
it's set as green because it still exits as 0 after that error :(
and here is the error when running golangci-lint against that PR :
$ golangci-lint run
pkg/apis/pipeline/v1alpha2/cluster_task_conversion.go:34:1: receiver name sink should be consistent with previous receiver name source for ClusterTask (golint)
func (sink *ClusterTask) ConvertDown(ctx context.Context, source apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha2/pipeline_conversion.go:33:1: receiver name sink should be consistent with previous receiver name source for Pipeline (golint)
func (sink *Pipeline) ConvertDown(ctx context.Context, source apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha2/task_conversion.go:34:1: receiver name sink should be consistent with previous receiver name source for Task (golint)
func (sink *Task) ConvertDown(ctx context.Context, source apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha2/taskrun_conversion.go:34:1: receiver name sink should be consistent with previous receiver name source for TaskRun (golint)
func (sink *TaskRun) ConvertDown(ctx context.Context, source apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha1/cluster_task_conversion.go:41:1: receiver name sink should be consistent with previous receiver name source for ClusterTask (golint)
func (sink *ClusterTask) ConvertDown(ctx context.Context, obj apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha1/pipeline_conversion.go:74:1: receiver name sink should be consistent with previous receiver name source for Pipeline (golint)
func (sink *Pipeline) ConvertDown(ctx context.Context, obj apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha1/pipeline_conversion.go:84:1: receiver name sink should be consistent with previous receiver name source for PipelineSpec (golint)
func (sink *PipelineSpec) ConvertDown(ctx context.Context, source v1alpha2.PipelineSpec) error {
^
pkg/apis/pipeline/v1alpha1/pipeline_conversion.go:99:1: receiver name sink should be consistent with previous receiver name source for PipelineTask (golint)
func (sink *PipelineTask) ConvertDown(ctx context.Context, source v1alpha2.PipelineTask) error {
^
pkg/apis/pipeline/v1alpha1/task_conversion.go:103:1: receiver name sink should be consistent with previous receiver name source for Task (golint)
func (sink *Task) ConvertDown(ctx context.Context, obj apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha1/task_conversion.go:113:1: receiver name sink should be consistent with previous receiver name source for TaskSpec (golint)
func (sink *TaskSpec) ConvertDown(ctx context.Context, source *v1alpha2.TaskSpec) error {
^
pkg/apis/pipeline/v1alpha1/taskrun_conversion.go:66:1: receiver name sink should be consistent with previous receiver name source for TaskRun (golint)
func (sink *TaskRun) ConvertDown(ctx context.Context, obj apis.Convertible) error {
^
pkg/apis/pipeline/v1alpha1/taskrun_conversion.go:79:1: receiver name sink should be consistent with previous receiver name source for TaskRunSpec (golint)
func (sink *TaskRunSpec) ConvertDown(ctx context.Context, source *v1alpha2.TaskRunSpec) error {
^
pkg/apis/pipeline/v1alpha1/taskrun_conversion.go:83:1: receiver name sink should be consistent with previous receiver name source for TaskRunStatus (golint)
func (sink *TaskRunStatus) ConvertDown(ctx context.Context, source *v1alpha2.TaskRunStatus) error {
^
@chmouel seems like you are using outdated version of golang-ci where it was warning. Can you please try v1.23.3?
Hi, can you please try again with
1.23.2?
1.23.6 again.
Yes, but still the same
marcelloh@MacMarcel impact % golangci-lint version
golangci-lint has version v1.23.6 built from (unknown, mod sum: "h1:dxnT1QFIpTeVoFUPaVDeFJJ+To++8ANYsQ2JIxJY02s=") on (unknown)
marcelloh@MacMarcel impact % golangci-lint run
WARN [runner] Can't run linter goanalysis_metalinter: ST1008: failed prerequisites: [email protected]/aanzeeonline/impact/compare
ERRO Running error: ST1008: failed prerequisites: [email protected]/aanzeeonline/impact/compare
@marcelloh try cleaning your cache after update. rm -rf ~/.cache/golangci-lint on linux + v1.23.6.
I work on a Mac and I did
golangci-lint cache clean
But same results :-(
Can you please try binary release instead of go-getted one?
The warning log lines confuse me.
marcelloh@MacMarcel impact % golangci-lint version
golangci-lint has version 1.23.6 built from b9eef79 on 2020-02-10T17:51:52Z
marcelloh@MacMarcel impact % golangci-lint cache clean
marcelloh@MacMarcel impact % golangci-lint run
WARN [runner] Can't run linter goanalysis_metalinter: S1001: failed prerequisites: [email protected]/aanzeeonline/impact/compare, [email protected]/aanzeeonline/impact/compare
ERRO Running error: S1001: failed prerequisites: [email protected]/aanzeeonline/impact/compare, [email protected]/aanzeeonline/impact/compare
Also hitting this on v1.23.6 installed via:
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6
Ran into the same issue.
It happened when I changed function signature, but did not change the caller.
So it would not even build.
But the error message is not helping.
Hi, sorry for no response, still out of capacity.
Please note that you need v1.23.7 to work with go1.14.
The most common cases of "failed prerequisites" is compilation error or outdated golangci version, you can run it with -v flag to get a verbose output (but in build error case it can still be not very verbose).
I'll try to make such errors more explicit soon, but until then, please check following:
goreleaser release --snapshot command).go vet ./... command is not returning any build errors.curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7
golangci-lint version : 1.23.6 ???
golangci-lint has version 1.23.6 built from b9eef79 on 2020-02-10T17:51:52Z
and with this version:
Checking with golangci-lint impact develop
INFO [config_reader] Config search paths: [./ /Users/marcelloh/data/go-business/impact /Users/marcelloh/data/go-business /Users/marcelloh/data /Users/marcelloh /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (compiled_files|exports_file|imports|name|deps|files|types_sizes) took 235.048355ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 3.804359ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 740.287693ms with top 10 stages: buildssa: 250.940633ms, dupl: 58.856365ms, interfacer: 41.813801ms, gocritic: 38.270463ms, goimports: 27.178942ms, unparam: 26.373733ms, gofmt: 24.712488ms, gosec: 19.805086ms, depguard: 18.151934ms, unconvert: 16.010941ms
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
INFO [runner] processing took 4.06µs with stages: max_same_issues: 2.103µs, skip_dirs: 267ns, nolint: 211ns, max_from_linter: 198ns, cgo: 136ns, autogenerated_exclude: 126ns, filename_unadjuster: 123ns, path_shortener: 122ns, identifier_marker: 121ns, source_code: 118ns, diff: 114ns, path_prettifier: 113ns, skip_files: 108ns, exclude: 53ns, max_per_file_from_linter: 52ns, exclude-rules: 48ns, uniq_by_line: 47ns
INFO [runner] linters took 316.380506ms with stages: goanalysis_metalinter: 316.345018ms
ERRO Running error: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
INFO Memory: 7 samples, avg is 108.3MB, max is 137.6MB
INFO Execution took 565.28832ms
make: * [check] Error 3
marcelloh@MacMarcel impact %
The issue seems to be fixed on my end with v1.23.8
golangci-lint --version
golangci-lint has version 1.23.8 built from 76a82c6 on 2020-03-04T14:27:24Z
INFO [config_reader] Config search paths: [./ /Users/marcelloh/data/go-business/impact /Users/marcelloh/data/go-business /Users/marcelloh/data /Users/marcelloh /Users /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [lintersdb] Active 36 linters: [bodyclose deadcode depguard dogsled dupl errcheck funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret prealloc scopelint staticcheck structcheck stylecheck typecheck unconvert unparam varcheck whitespace]
INFO [loader] Go packages loading at mode 575 (files|imports|name|types_sizes|compiled_files|deps|exports_file) took 482.724ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 3.133854ms
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 8.429661078s with top 10 stages: buildssa: 5.077124171s, fact_purity: 424.837334ms, printf: 418.806176ms, ctrlflow: 398.153265ms, fact_deprecated: 343.332562ms, inspect: 312.516123ms, interfacer: 123.210901ms, unparam: 104.862487ms, dupl: 82.977274ms, gocritic: 78.730565ms
WARN [runner] Can't run linter goanalysis_metalinter: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
INFO [runner] processing took 4.192µs with stages: max_same_issues: 1.888µs, skip_dirs: 374ns, max_from_linter: 238ns, nolint: 236ns, path_prettifier: 184ns, filename_unadjuster: 183ns, cgo: 165ns, autogenerated_exclude: 136ns, skip_files: 134ns, diff: 131ns, identifier_marker: 130ns, source_code: 79ns, exclude: 67ns, max_per_file_from_linter: 65ns, path_shortener: 61ns, uniq_by_line: 61ns, exclude-rules: 60ns
INFO [runner] linters took 2.265496469s with stages: goanalysis_metalinter: 2.265460418s
ERRO Running error: assign: failed prerequisites: [email protected]/aanzeeonline/impact/compare
INFO Memory: 29 samples, avg is 249.8MB, max is 474.5MB
INFO Execution took 2.765896001s
make: * [check] Error 3
seems that the issue happens when a project cant be built
That's not the case, the project is compiling just fine and the tests succeed.
That's not the case, the project is compiling just fine and the tests succeed.
@marcelloh I think @unkeep meant the issue with golangci-lint arises when _a_ project being linted cannot be built. I didn't get the impression "a project" referred to golangci-lint.
@marcelloh If you run go vet ./... in the project you are trying to lint do you get any warnings or messages?
seems that the issue happens when a project cant be built
A more nuanced version of this:
I have a project that depends on thrift-generated code. There's a thrift-go bug that causes the compiler to generate invalid go code. Certain modules will not compile. However - these are also modules that we don't need to import or compile at all.
Since they're in our source tree, however, the entire project fails linting - because the "project" can't be built. This is not the behavior in v1.19.0 and prior, where we just got warnings about the bad generated code.
go vet ./... just gives an enter: so no warnings
@marcelloh What is the error or output of go vet ./... in the project you were trying to lint?
nothing, just it goes to the next line, nou output, no warning or error
when I do a wrong package it shows output:
go vet wrong [enter]
can't load package: package wrong: cannot find package "." in:
/Users/marcelloh/data/go-business/impact/vendor/wrong
As @FuzzyStatic stated above, v1.23.8 fixes the issue. Works fine on my end
Hey, I've tried to make those errors more descriptive, so in v1.24.0 you will get more details about actual error.
I hope that it will help.
I'll close this meta-issue for now. Please report any unexpected errors reported by failed prerequisites as separate issues, thanks!
To fix this error exclude linter - goprintffuncname
Sharing how I resolved mine. Aside from there is something that I had to fix in my project folder, it also has something to do with golangci-lint behaviour. It wasn't consistent with its error. I am using golangci-lint v1.22.2. Here are the steps I performed:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.8golangci-lint cache clean, just an additional step to clear the environment. Again, I really don't know why.golangci-lint run. At this point, I inspected the 1st and 2nd WARNING lines and they gave me a hint. I had testFile.go of package main. There was a redeclaration of main. I did not encounter this issue in the 1st version which it should had printed as one of the WARNING/ERRORS. By the way, compilation and building via vscode worked just fine.golangci-lint run already worked after that -- already getting lint recommendations.It was a weird and painful ordeal. Anyone have an idea what's going on?
Anyhow, hope these steps would help resolve your issue.
we are also seeing this issue -via golangci-lint-actions- when updating gonum/plot to use Gioui (that uses cgo under the hood to interact with the graphics layer of the OS)
https://github.com/gonum/plot/pull/628
anything we could do on our end?
FYI, golangci-lint-actions was failing to analyze the CGo dependencies b/c while the build GitHub Action did have all the required C/C++ packages installed, the golangci-lint GitHub Action didn't (they are executed in distinct environments/containers).
adding a run-step with the appropriate apt install xxx command fixed it.
This is still happening with 1.28, both locally and on CI:
local:
golangci-lint run
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package utf8: failed to stat file /Users/andig/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: stat /Users/andig/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package sys: failed to stat file /Users/andig/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: stat /Users/andig/Library/Caches/golangci-lint/e2/e24a307ec1d4f19e6023639f91a2b1e33a9a2bbadcba08e4b8a7765245b19de7-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package runtime: failed to stat file /Users/andig/Library/Caches/golangci-lint/7c/7ce4893d66ce16c2624776544473b68fafe330e74224c8522588ecee92ee9e7c-d: stat /Users/andig/Library/Caches/golangci-lint/7c/7ce4893d66ce16c2624776544473b68fafe330e74224c8522588ecee92ee9e7c-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package syscall: failed to stat file /Users/andig/Library/Caches/golangci-lint/26/2679eabe877eea105e62e7316dad9a6c482eeb95f9bbe09a4ccfd32d0c790e86-d: stat /Users/andig/Library/Caches/golangci-lint/26/2679eabe877eea105e62e7316dad9a6c482eeb95f9bbe09a4ccfd32d0c790e86-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package fmt: failed to stat file /Users/andig/Library/Caches/golangci-lint/10/10a1358a7c3f0744ce77b1a8380e4bd9af94c864b08e9d452bde8c6fce741d2e-d: stat /Users/andig/Library/Caches/golangci-lint/10/10a1358a7c3f0744ce77b1a8380e4bd9af94c864b08e9d452bde8c6fce741d2e-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package json: failed to stat file /Users/andig/Library/Caches/golangci-lint/01/01804f1ca8b01ff89900506df197abf4a10b565f6d7eee270f80bca0eff0e3d5-d: stat /Users/andig/Library/Caches/golangci-lint/01/01804f1ca8b01ff89900506df197abf4a10b565f6d7eee270f80bca0eff0e3d5-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package yaml: failed to stat file /Users/andig/Library/Caches/golangci-lint/00/00101f8ad23a6f0b4f857af8ded9d7a43569006ae03c3d4bf6f793cfe8dd8a8f-d: stat /Users/andig/Library/Caches/golangci-lint/00/00101f8ad23a6f0b4f857af8ded9d7a43569006ae03c3d4bf6f793cfe8dd8a8f-d: no such file or directory
WARN [runner/goanalysis_metalinter/goanalysis] Failed to get persisted facts: failed to get data from low-level cache by key buildir/facts for package toml: failed to stat file /Users/andig/Library/Caches/golangci-lint/28/28804e8e8ea9079276a8b08534a16a3a794e23123f14f810392b4887d50ed653-d: stat /Users/andig/Library/Caches/golangci-lint/28/28804e8e8ea9079276a8b08534a16a3a794e23123f14f810392b4887d50ed653-d: no such file or directory
It is an intermittent issue, rerunning always solves this type of problem.
Could we please reopen this issue?
According to comment above it is still an issue.
Below is what finally fixed the issue for me.
I found that my IDE (IntelliJ IDEA) was actually putting in a GOROOT and GOPATH environment variable when running golangci-lint as a file watcher (automatically run whenever a file change and save occurs). When I removed these environment variables and allowed it to use my system environment variables, I no longer got the error message of Can't run linter goanalysis_metalinter: S1006: failed prerequisites.
Basically, my IDE was messing with my GOROOT and GOPATH environment variables, and that's why I was getting a bunch of errors about not being able to import any packages (even from the standard library). This may not work for you, but it's worth checking out what's going on with these environment variables when you run golangci-lint.
Most helpful comment
According to comment above it is still an issue.