Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sporadic "Can't run linter goanalysis_metalinter: findcall: analysis skipped:" error on a cold cache #885

Closed
3 tasks done
agnivade opened this issue Dec 10, 2019 · 10 comments
Labels
bug Something isn't working

Comments

@agnivade
Copy link
Contributor

Thank you for creating the issue!

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

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

https://github.com/mattermost/mattermost-server/blob/master/.golangci.yml

Go environment
$ go version && go env
go version go1.13.3 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/agniva/.cache/go-build"
GOENV="/home/agniva/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY="gitlab.com"
GONOSUMDB="gitlab.com"
GOOS="linux"
GOPATH="/home/agniva/play/go"
GOPRIVATE="gitlab.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/agniva/play/go/src/github.com/mattermost/mattermost-server/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-build167304403=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
$golangci-lint cache clean
$golangci-lint run -v ./...
INFO [config_reader] Config search paths: [./ /home/agniva/play/go/src/github.com/mattermost/mattermost-server /home/agniva/play/go/src/github.com/mattermost /home/agniva/play/go/src/github.com /home/agniva/play/go/src /home/agniva/play/go /home/agniva/play /home/agniva /home /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 10 linters: [deadcode gofmt golint gosimple govet ineffassign structcheck unconvert unused varcheck] 
INFO [loader] Go packages loading at mode 575 (exports_file|files|name|types_sizes|compiled_files|deps|imports) took 5.387007051s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 322.661431ms 
INFO [runner/unused/goanalysis] analyzers took 15.090283129s with top 10 stages: buildssa: 10.301643416s, U1000: 4.788639713s 
INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 1m41.150561507s with top 10 stages: buildssa: 38.616755762s, gofmt: 13.941436377s, golint: 12.181338544s, ineffassign: 7.597249561s, unconvert: 5.306994472s, inspect: 5.274666727s, varcheck: 2.707316975s, printf: 1.946889246s, ctrlflow: 1.569463711s, shadow: 1.219817439s 
WARN [runner] Can't run linter goanalysis_metalinter: findcall: analysis skipped: errors in package: [/home/agniva/play/go/src/github.com/mattermost/mattermost-server/testlib/resources.go:64:58: cannot use (func(fileInfo os.FileInfo) bool literal) (value of type func(fileInfo os.FileInfo) bool) as func(os.FileInfo) bool value in argument to fileutils.FindPath /home/agniva/play/go/src/github.com/mattermost/mattermost-server/testlib/resources.go:49:57: cannot use (func(fileInfo os.FileInfo) bool literal) (value of type func(fileInfo os.FileInfo) bool) as func(os.FileInfo) bool value in argument to fileutils.FindPath] 
INFO [runner] Issues before processing: 3, after processing: 0 
INFO [runner] Processors filtering stat (out/in): identifier_marker: 2/2, cgo: 3/3, filename_unadjuster: 3/3, path_prettifier: 3/3, skip_files: 3/3, exclude: 2/2, exclude-rules: 0/2, skip_dirs: 3/3, autogenerated_exclude: 2/3 
INFO [runner] processing took 270.673µs with stages: path_prettifier: 85.725µs, exclude: 82.895µs, autogenerated_exclude: 34.321µs, skip_dirs: 30.317µs, identifier_marker: 25.779µs, exclude-rules: 4.983µs, cgo: 2.18µs, filename_unadjuster: 1.048µs, diff: 709ns, max_same_issues: 707ns, nolint: 485ns, max_from_linter: 399ns, path_shortener: 254ns, max_per_file_from_linter: 243ns, source_code: 235ns, uniq_by_line: 201ns, skip_files: 192ns 
INFO [runner] linters took 24.468562251s with stages: goanalysis_metalinter: 16.106297827s, unused: 8.361894689s 
INFO File cache stats: 0 entries of total size 0B 
INFO Memory: 187 samples, avg is 1190.1MB, max is 2485.7MB 
INFO Execution took 30.376538862s                 

You can see such an instance of this here: https://golangci.com/r/github.com/mattermost/mattermost-server/pulls/13090

@agnivade
Copy link
Contributor Author

Some updates to the investigation. It seems to trigger only when unused and govet both are present. Just keeping unused does not trigger it, and just keeping govet does not trigger it either. Only when both are present, this error shows up.

@ernado
Copy link
Member

ernado commented Jan 7, 2020

I've tried to debug this issue once again and got some results.

For some reason go/types is failing during type checking, e.g. there are two ResponseWriter from different package http ("net/http") with different type "colors" (one is black, and package has 39 imports, other is white, and package has 28 imports).
It looks like some kind of data race that corrupts type checking inputs.

cc @jirfag

image

go1.13.3 linux/amd64, v1.22.2

@ernado
Copy link
Member

ernado commented Jan 7, 2020

Update: I've bisected to #758, 95ec0cf
After 95ec0cf warnings like 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] started to appear, caused by error from type checker.
Then we started returning non-zero exit codes instead of warnings.

Additional investigation is still needed.

But for now, there are possible workarounds:

  1. Disable unused linter
  2. Use v1.19.1 which is unaffected

Update (2): please try #914, I have a draft for fix which probably solves this issue, at least I can't reproduce it locally. I'm still not sure if it is a proper fix.

@agnivade
Copy link
Contributor Author

agnivade commented Jan 8, 2020

Thanks @ernado for looking into this.

@agnivade
Copy link
Contributor Author

agnivade commented Jan 8, 2020

I will try #914 when I get some time.

maraino added a commit to smallstep/cli that referenced this issue Jan 11, 2020
maraino added a commit to smallstep/certificates that referenced this issue Jan 11, 2020
nono added a commit to cozy/cozy-stack that referenced this issue Jan 15, 2020
Currently, golangci-lint has some issues that make it fail randomly.
Disabling the `unused` linter seems to improve things, so let's do that
until golangci-lint has a fix. See:

- golangci/golangci-lint#827
- golangci/golangci-lint#885
@dahu33
Copy link
Member

dahu33 commented Jan 22, 2020

Any update on this?

@ernado
Copy link
Member

ernado commented Feb 2, 2020

Hi, please try v1.23.2 version withc @ksoichiro's fix.

Sorry that it took so long.

@agnivade
Copy link
Contributor Author

agnivade commented Feb 3, 2020

Ok, so this error has gone away, but this release seems to have new bugs :(

WARN [runner] Can't process result by autogenerated_exclude processor: can't filter issue result.Issue{FromLinter:"golint", Text:"exported var SystemEmojis should have comment or be unexported", SourceLines:[]string(nil), Replacement:(*result.Replacement)(nil), Pkg:(*packages.Package)(0xc0017860f0), LineRange:(*result.Range)(nil), Pos:token.Position{Filename:"model/emoji_data.go", Offset:132, Line:6, Column:5}, HunkPos:0}: failed to get doc of file model/emoji_data.go: failed to scan file: bufio.Scanner: token too long 

It seems like #484, but it wasn't there in 1.21.

We cannot migrate to 1.23.2 unless we get a clean output without any warnings.

I am going to close this issue as this seems to have been fixed. Thanks for your work.

@agnivade agnivade closed this as completed Feb 3, 2020
@ernado
Copy link
Member

ernado commented Feb 3, 2020

Thank you for feedback, @agnivade, I'll take a look at this issue too, seems like much more straightforward to debug.

@agnivade
Copy link
Contributor Author

agnivade commented Feb 3, 2020

Perfect, thanks so much ! Looking forward to the fix.

@ernado ernado unpinned this issue Feb 3, 2020
agnivade added a commit to mattermost/mattermost that referenced this issue Feb 5, 2020
golangci/golangci-lint#885 is fixed wth 1.23.3.
We can now bring back unused.
hanzei pushed a commit to mattermost/mattermost that referenced this issue Feb 15, 2020
golangci/golangci-lint#885 is fixed wth 1.23.3.
We can now bring back unused.
genarocoronel pushed a commit to genarocoronel/GoLang-mattermostserver that referenced this issue Jun 9, 2021
golangci/golangci-lint#885 is fixed wth 1.23.3.
We can now bring back unused.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants