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

ERRO Running error: buildir: analysis skipped: errors in package #1190

Closed
3 tasks done
akarl opened this issue Jun 18, 2020 · 3 comments
Closed
3 tasks done

ERRO Running error: buildir: analysis skipped: errors in package #1190

akarl opened this issue Jun 18, 2020 · 3 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@akarl
Copy link

akarl commented Jun 18, 2020

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.27.0 built from fb74c2e on 2020-05-13T18:48:26Z
Config file
$ cat .golangci.yml
cat: .golangci.yml: No such file or directory
Go environment
$ go version && go env
go version go1.14.4 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/username/.cache/go-build"
GOENV="/home/username/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY="work.domain/*"
GONOSUMDB="work.domain/*"
GOOS="linux"
GOPATH="/home/username/go"
GOPRIVATE="work.domain/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/username/workspace/project/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-build477740903=/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/username/workspace/project /home/username/workspace /home/username /home /] 
INFO [lintersdb] Active 10 linters: [deadcode errcheck gosimple govet ineffassign staticcheck structcheck typecheck unused varcheck] 
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|imports|files|name|compiled_files|exports_file) took 366.215094ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 5.737105ms 
INFO [linters context/goanalysis] analyzers took 19.138544687s with top 10 stages: buildir: 16.259049518s, inspect: 817.31308ms, ctrlflow: 615.274302ms, printf: 481.902916ms, fact_deprecated: 457.945407ms, fact_purity: 376.953927ms, deadcode: 22.307961ms, ineffassign: 17.454063ms, SA9003: 7.568652ms, SA1027: 7.150707ms 
WARN [runner] Can't run linter goanalysis_metalinter: S1038: failed prerequisites: [(inspect@work.domain/reg/project/pkg/mail [work.domain/reg/project/pkg/mail.test], isgenerated@work.domain/reg/project/pkg/mail [work.domain/reg/project/pkg/mail.test]): analysis skipped: errors in package: [/home/username/workspace/project/pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest]] 
INFO [linters context/goanalysis] analyzers took 278.035992ms with top 10 stages: buildir: 246.749649ms, U1000: 31.286343ms 
WARN [runner] Can't run linter unused: buildir: analysis skipped: errors in package: [/home/username/workspace/project/pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest] 
INFO [runner] processing took 3.524µs with stages: max_same_issues: 901ns, nolint: 332ns, skip_dirs: 318ns, max_from_linter: 287ns, cgo: 200ns, filename_unadjuster: 161ns, source_code: 159ns, path_prettifier: 154ns, path_shortener: 152ns, skip_files: 151ns, diff: 150ns, autogenerated_exclude: 150ns, identifier_marker: 144ns, uniq_by_line: 69ns, exclude: 66ns, exclude-rules: 65ns, max_per_file_from_linter: 65ns 
INFO [runner] linters took 9.185514991s with stages: goanalysis_metalinter: 8.591281736s, unused: 594.182824ms 
ERRO Running error: buildir: analysis skipped: errors in package: [/home/username/workspace/project/pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest] 
INFO Memory: 97 samples, avg is 271.4MB, max is 474.1MB 
INFO Execution took 9.564607396s   

I have an error, the SetupDB function doesn't exist any more. And when I run golangci-lint run I get the following output:

WARN [runner] Can't run linter goanalysis_metalinter: S1033: failed prerequisites: [(inspect@work.domain/reg/project/pkg/mail [work.domain/reg/project/pkg/mail.test], isgenerated@work.domain/reg/project/pkg/mail [work.domain/reg/project/pkg/mail.test]): analysis skipped: errors in package: [/home/username/workspace/project/pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest]] 
WARN [runner] Can't run linter unused: buildir: analysis skipped: errors in package: [/home/username/workspace/project/pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest] 
ERRO Running error: buildir: analysis skipped: errors in package: [/home/username/workspace/project/pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest] 

If I disable everything and just run the typecheck linter I get a much better output:

$  golangci-lint run --disable-all -E typecheck
pkg/mail/mail_test.go:31:21: SetupDB not declared by package servicetest (typecheck)
	dsn := servicetest.SetupDB(t)
	                   ^

Is you can see, I get around the issue in my VIM config by first running only typecheck and if that doesn't give me any errors, then I can run the other linters.

@akarl akarl added the bug Something isn't working label Jun 18, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Jun 18, 2020

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@bombsimon
Copy link
Member

golangci-lint requires the code to compile for it to lint. The main philosophy behind that is that code that doesn't compile shouldn't be linted since it's not valid (maybe not my personal opinion). I guess #1043 would solve your problem by handling compilation issues as lint errors. This wouldn't be the same as running a specific check like typecheck but it would have the linter report the same error as go build as a linter error. I think #1172 is related too, we should probably close one of them and have a single issue for this feature.

@iwankgb
Copy link
Contributor

iwankgb commented Jul 4, 2020

@akarl @bombsimon see #1043 for any further work, please.

@iwankgb iwankgb closed this as completed Jul 4, 2020
@iwankgb iwankgb added the duplicate This issue or pull request already exists label Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants