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

User should be notified that enabled linter failed/panicked #78

Closed
DarkEye123 opened this issue Jun 8, 2018 · 5 comments
Closed

User should be notified that enabled linter failed/panicked #78

DarkEye123 opened this issue Jun 8, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@DarkEye123
Copy link

During regular run a message saying "Congrats! No issues were found." is visible.
It should contain some warning about failing linter and possible a hint to use verbose option as well.

See example:

swicus PI-1215-migration_endpoint ✗ 2h44m ▲ ◒ ➜ golangci-lint run -v                                         
INFO[0000] Config search paths: [./ /Users/matej.lesko/go/src/github.com/solarwindscloud/swicus /Users/matej.lesko/go/src/github.com/solarwindscloud /Users/matej.lesko/go/src/github.com /Users/matej.lesko/go/src /Users/matej.lesko/go /Users/matej.lesko /Users /] 
INFO[0000] Used config file .golangci.yml               
INFO[0000] Active 17 linters: [deadcode dupl errcheck gas goconst gocyclo gofmt golint govet ineffassign interfacer maligned megacheck structcheck typecheck unconvert varcheck] 
INFO[0000] set GOROOT="/usr/local/opt/[email protected]/libexec/" 
INFO[0000] Found paths for analysis for 1.727533ms: [./authserver ./cmd/swicus ./db ./db/migrate ./hash ./metrics ./notifier ./snowflake ./types ./types/ctxkey ./types/scope ./types/swerr ./userservice ./valid ./valid/commitlog ./valid/commitlog/static ./valid/gen] 
INFO[0002] Program loading took 2.875186597s            
INFO[0003] SSA repr building took 761.966211ms          
INFO[0004] worker.2 took 392.970712ms with stages: govet: 259.126903ms, gofmt: 83.370094ms, ineffassign: 34.453291ms, structcheck: 5.70993ms, errcheck: 5.549982ms, deadcode: 4.732017ms, typecheck: 514ns 
INFO[0004] worker.3 took 389.2041ms with stages: interfacer: 147.331055ms, dupl: 129.455256ms, gas: 71.787171ms, goconst: 23.963243ms, varcheck: 9.152789ms, unconvert: 2.921552ms, gocyclo: 2.422537ms, maligned: 2.133665ms 
INFO[0004] worker.4 took 457.37095ms with stages: golint: 457.349992ms 
INFO[0004] Panic stack trace: goroutine 1564 [running]:
runtime/debug.Stack(0x17e2b38, 0x11, 0xc4443366f0)
	/usr/local/opt/[email protected]/libexec/src/runtime/debug/stack.go:24 +0xa7
github.com/golangci/golangci-lint/pkg/lint.runLinterSafe.func1(0xc444337c30)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:34 +0xc2
panic(0x16e4ba0, 0xc44f19f1a0)
	/usr/local/opt/[email protected]/libexec/src/runtime/panic.go:502 +0x229
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*Linter).Lint(0xc444337470, 0xc4201a8640, 0xc420162580, 0xc441cd1040, 0x174e440, 0x1c265e0, 0xc420427490)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:446 +0x2e7c
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lintutil.(*runner).lint(0xc4204275a8, 0xc4201a8640, 0xc420162580, 0xc441cd1040, 0x0, 0x0, 0x0)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lintutil/util.go:292 +0xc8
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lintutil.Lint(0xc44e37f3c0, 0x3, 0x4, 0xc4201a8640, 0xc420162580, 0xc441cd1040, 0xc444337710, 0x4, 0xc4204276e8, 0x1012329, ...)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lintutil/util.go:248 +0x1f5
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lintutil.ProcessFlagSet(0xc44fa88ba0, 0x3, 0x4, 0xc44fa88b40, 0xc4201a8640, 0xc420162580, 0xc441cd1040, 0x4, 0x1, 0xc4200608b8)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lintutil/util.go:203 +0x615
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/cmd/megacheck.Run(0xc4201a8640, 0xc420162580, 0xc441cd1040, 0x10101, 0x0, 0x1, 0xc420060970)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/cmd/megacheck/megacheck.go:124 +0x74a
github.com/golangci/golangci-lint/pkg/golinters.Megacheck.Run(0x10101, 0x1898420, 0xc4200d51a0, 0xc44fa19720, 0x102ac39, 0x8, 0xc432277140, 0x0, 0xc420060a80)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/golinters/megacheck.go:54 +0x7d
github.com/golangci/golangci-lint/pkg/lint.runLinterSafe(0x1898420, 0xc4200d51a0, 0xc44fa19720, 0x18976a0, 0xc420c7c010, 0x10100, 0xc4200fe480, 0x3, 0x3, 0x1, ...)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:38 +0xbf
github.com/golangci/golangci-lint/pkg/lint.runWorker.func1()
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:70 +0x8b
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc44fa99b80, 0x17d0872, 0x9, 0xc420060e28)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:73 +0x53
github.com/golangci/golangci-lint/pkg/lint.runWorker(0x1898420, 0xc4200d51a0, 0xc44fa19720, 0xc44fa88960, 0xc44fa889c0, 0xc44f52ab70, 0x8)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:69 +0x19e
github.com/golangci/golangci-lint/pkg/lint.(*SimpleRunner).runWorkers.func1(0xc44f52ab60, 0x1898420, 0xc4200d51a0, 0xc44fa19720, 0xc44fa88960, 0xc44fa889c0, 0xc44fa88a20, 0x4, 0x4, 0x0)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:124 +0x117
created by github.com/golangci/golangci-lint/pkg/lint.(*SimpleRunner).runWorkers
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/pkg/lint/runner.go:121 +0x1a5
 
INFO[0004] worker.1 took 1.243648816s with stages: megacheck: 1.243617692s 
INFO[0004] Can't run linter megacheck: panic occured: panic: runtime error: invalid memory address or nil pointer dereference, stack: goroutine 1846 [running]:
runtime/debug.Stack(0xc44aabef28, 0x16f8460, 0x1ca1fc0)
	/usr/local/opt/[email protected]/libexec/src/runtime/debug/stack.go:24 +0xa7
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*Linter).Lint.func1.1(0xc44fa80720, 0x13)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:427 +0x6e
panic(0x16f8460, 0x1ca1fc0)
	/usr/local/opt/[email protected]/libexec/src/runtime/panic.go:502 +0x229
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck.(*Checker).CheckDeprecated.func1(0x1893060, 0xc42007cb20, 0xc44cdfc3a0)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck/lint.go:2376 +0x145
go/ast.inspector.Visit(0xc44cdfc3a0, 0x1893060, 0xc42007cb20, 0x1010398, 0x173e280)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:373 +0x3a
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1893060, 0xc42007cb20)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:52 +0x66
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1892aa0, 0xc42007e680)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:74 +0xb97
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1892ae0, 0xc42043c570)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:84 +0x144
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1893160, 0xc42007d600)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:161 +0x27bf
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1893220, 0xc42043c540)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:318 +0x2aec
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1892c60, 0xc42007ec80)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:331 +0xf2f
go/ast.walkDeclList(0x1890740, 0xc44cdfc3a0, 0xc4210e4800, 0x64, 0x80)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:38 +0x81
go/ast.Walk(0x1890740, 0xc44cdfc3a0, 0x1892b20, 0xc420127d80)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:353 +0x2650
go/ast.Inspect(0x1892b20, 0xc420127d80, 0xc44cdfc3a0)
	/usr/local/opt/[email protected]/libexec/src/go/ast/walk.go:385 +0x4b
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck.(*Checker).CheckDeprecated(0xc44e38d380, 0xc44e35b540)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck/lint.go:2406 +0xa5
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck.(*Checker).CheckDeprecated-fm(0xc44e35b540)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck/lint.go:235 +0x34
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*Linter).Lint.func1(0xc44fa80720, 0xc42d9dc940, 0xc44fa80690, 0x13, 0xc44e35b540)
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:436 +0xc7
created by github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*Linter).Lint
	/Users/matej.lesko/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:424 +0x25a0
 
INFO[0004] Workers idle times: #2: 849.247497ms, #3: 841.003268ms, #4: 785.946032ms 
INFO[0004] processing took 33.331417ms with stages: exclude: 25.154019ms, nolint: 7.6918ms, path_prettifier: 406.631µs, cgo: 71.489µs, uniq_by_line: 1.827µs, max_from_linter: 1.363µs, max_same_issues: 1.361µs, diff: 1.168µs, skip_files: 901ns, max_per_file_from_linter: 858ns 
Congrats! No issues were found.
INFO[0004] Extracting issued lines took 0s              
INFO[0004] Memory: 39 samples, avg is 519.6MB, max is 1024.8MB 
INFO[0004] Execution took 4.883715971s                
@jirfag
Copy link
Member

jirfag commented Jun 11, 2018

Thank you, it's a right point. I am planning to do it after fixing all known linters crashes. Last known crash (the same in your log) was fixed in master yesterday. I think after a few days I enable warn logging of all errors

@jirfag jirfag added the bug Something isn't working label Jun 11, 2018
golangci pushed a commit that referenced this issue Jun 13, 2018
golangci pushed a commit that referenced this issue Jun 14, 2018
1. Log all warnings, don't hide none of them
2. Write fatal messages (stop analysis) with error log level
3. Remove ugly timestamp counter from logrus output
4. Print nested module prefix in log
5. Make logger abstraction: no global logging anymore
6. Refactor config reading to config.FileReader struct to avoid passing
logger into every function
7. Replace exit codes hardcoding with constants in exitcodes package
8. Fail test if any warning was logged
9. Fix calculation of relative path if we analyze parent dir ../
10. Move Runner initialization from Executor to NewRunner func
11. Log every AST parsing error
12. Properly print used config file path in verbose mode
13. Print package files if only 1 package is analyzedin verbose mode,
  print not compiling packages in verbose mode
14. Forbid usage of github.com/sirupsen/logrus by DepGuard linter
15. Add default ignore pattern to folint: "comment on exported const"
golangci pushed a commit that referenced this issue Jun 14, 2018
1. Log all warnings, don't hide none of them
2. Write fatal messages (stop analysis) with error log level
3. Remove ugly timestamp counter from logrus output
4. Print nested module prefix in log
5. Make logger abstraction: no global logging anymore
6. Refactor config reading to config.FileReader struct to avoid passing
logger into every function
7. Replace exit codes hardcoding with constants in exitcodes package
8. Fail test if any warning was logged
9. Fix calculation of relative path if we analyze parent dir ../
10. Move Runner initialization from Executor to NewRunner func
11. Log every AST parsing error
12. Properly print used config file path in verbose mode
13. Print package files if only 1 package is analyzedin verbose mode,
  print not compiling packages in verbose mode
14. Forbid usage of github.com/sirupsen/logrus by DepGuard linter
15. Add default ignore pattern to folint: "comment on exported const"
golangci pushed a commit that referenced this issue Jun 14, 2018
1. Log all warnings, don't hide none of them
2. Write fatal messages (stop analysis) with error log level
3. Remove ugly timestamp counter from logrus output
4. Print nested module prefix in log
5. Make logger abstraction: no global logging anymore
6. Refactor config reading to config.FileReader struct to avoid passing
logger into every function
7. Replace exit codes hardcoding with constants in exitcodes package
8. Fail test if any warning was logged
9. Fix calculation of relative path if we analyze parent dir ../
10. Move Runner initialization from Executor to NewRunner func
11. Log every AST parsing error
12. Properly print used config file path in verbose mode
13. Print package files if only 1 package is analyzedin verbose mode,
  print not compiling packages in verbose mode
14. Forbid usage of github.com/sirupsen/logrus by DepGuard linter
15. Add default ignore pattern to folint: "comment on exported const"
@jirfag jirfag closed this as completed in 9181ca7 Jun 14, 2018
@jirfag
Copy link
Member

jirfag commented Jun 14, 2018

fixed in #101

@rfay
Copy link

rfay commented Nov 6, 2018

Hmm, I still see this in golangci-lint v1.10.2, which was released Sept 2, 2018, which is long after this #101 was merged.

WARN [runner/staticcheck] Can't run megacheck because of compilation errors in packages [github.com/drud/ddev/cmd/ddev/cmd_test]: cmd/ddev/cmd/auth-ssh_test.go:49: cannot convert "web" (untyped string constant) to *github.com/drud/ddev/pkg/ddevapp.ExecOpts and 15 more errors: run golangci-lint run --no-config --disable-all -E typecheck` to see all errors``

Basically, a compile error in test code is flagged but does not result in an error. If you think this is a different error, I'll be happy to open a new issue, but it's a super serious error because I've been counting on golangci-lint to fail on that kind of problem (gometalinter certainly does, we just gradually switched)

Edit: And I will test with 1.11.3 and see if the behavior has been fixed since 1.10.2.

@rfay
Copy link

rfay commented Nov 6, 2018

Yes, this is broken in 1.11.3, and easy to demonstrate.

  • mkdir junk
  • Place this file file in the junk directory: https://gist.github.com/rfay/36d05e93d4ec41340eac8ab998d091c0#file-auth-ssh_test-go
  • golangci-lint run --out-format=line-number --disable-all --enable=gofmt --enable=govet --enable=errcheck --enable=staticcheck --enable=ineffassign --enable=varcheck --enable=deadcode ./junk/...
  • Result is just a warning, with a zero result from the run: WARN [runner/staticcheck] Can't run megacheck because of compilation errors in packages [github.com/drud/junk.test]: -: junk/auth-ssh_test.go:15:2: cannot find package "github.com/stretchr/testify/assert" in any of: /usr/local/Cellar/go/1.11.2/libexec/src/github.com/stretchr/testify/assert (from $GOROOT) /Users/rfay/go/src/github.com/stretchr/testify/assert (from $GOPATH)

I'll open a new issue. (Opened #276)

@jirfag
Copy link
Member

jirfag commented Nov 6, 2018

thank you

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

3 participants