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

"No issues were found" even with an blank file #33

Closed
quantonganh opened this issue May 28, 2018 · 2 comments
Closed

"No issues were found" even with an blank file #33

quantonganh opened this issue May 28, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@quantonganh
Copy link

quantonganh commented May 28, 2018

Steps to reproduce:

  • cd /tmp
  • touch blank.go
  • then run golangci-lint run -v blank.go:
INFO[0000] Active linters: [deadcode govet errcheck megacheck gas varcheck ineffassign structcheck]
INFO[0000] Found paths for analysis for 56.244µs: [blank.go]
/tmp/blank.go:1:1: expected 'package', found 'EOF'
INFO[0000] Program loading took 3.005445ms
INFO[0000] SSA repr building took 7.026µs
INFO[0000] worker.3 took 1.807229ms with stages: errcheck: 924.983µs, ineffassign: 846.136µs, varcheck: 14.522µs, structcheck: 5.831µs, deadcode: 3.545µs
INFO[0000] worker.4 took 1.854175ms with stages: govet: 1.845642ms
INFO[0000] Panic stack trace: goroutine 38 [running]:
runtime/debug.Stack(0x17d70b6, 0x11, 0xc42042f7c8)
        /usr/local/Cellar/go/1.10.1/libexec/src/runtime/debug/stack.go:24 +0xa7
github.com/golangci/golangci-lint/pkg.runLinterSafe.func1(0xc42042fd10)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/runner.go:34 +0xc2
panic(0x16ee1a0, 0x1c8efa0)
        /usr/local/Cellar/go/1.10.1/libexec/src/runtime/panic.go:502 +0x229
go/token.(*File).Name(...)
        /usr/local/Cellar/go/1.10.1/libexec/src/go/token/position.go:105
github.com/golangci/golangci-lint/vendor/github.com/GoASTScanner/gas.(*Analyzer).ProcessProgram(0xc420104230, 0xc4200c4080)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/vendor/github.com/GoASTScanner/gas/analyzer.go:148 +0x16d
github.com/golangci/golangci-lint/pkg/golinters.Gas.Run(0x188a280, 0xc42013e840, 0xc4200fee10, 0x102a909, 0x8, 0xc420106200, 0x2, 0xc42013cc80)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/golinters/gas.go:34 +0x1c3
github.com/golangci/golangci-lint/pkg.runLinterSafe(0x188a280, 0xc42013e840, 0xc4200fee10, 0x18892c0, 0x1cc0a20, 0x0, 0x0, 0x0, 0x1881020, 0xc42041e3a0)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/runner.go:38 +0x9f
github.com/golangci/golangci-lint/pkg.runWorker.func1()
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/runner.go:61 +0x64
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc420106040, 0x17beda2, 0x3, 0xc42013ce60)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:73 +0x53
github.com/golangci/golangci-lint/pkg.runWorker(0x188a280, 0xc42013e840, 0xc4200fee10, 0xc4201a4d80, 0xc4201a4de0, 0xc4204c2008, 0x8)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/runner.go:60 +0x185
github.com/golangci/golangci-lint/pkg.(*SimpleRunner).runWorkers.func1(0xc420369450, 0x188a280, 0xc42013e840, 0xc4200fee10, 0xc4201a4d80, 0xc4201a4de0, 0xc4201a4e40, 0x4, 0x4, 0x0)
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/runner.go:118 +0x117
created by github.com/golangci/golangci-lint/pkg.(*SimpleRunner).runWorkers
        /Users/quanta/go/src/github.com/golangci/golangci-lint/pkg/runner.go:115 +0x1e6

INFO[0000] worker.1 took 6.643812ms with stages: gas: 6.461126ms
INFO[0000] Can't run linter gas: panic occured: runtime error: invalid memory address or nil pointer dereference
INFO[0000] worker.2 took 15.14121ms with stages: megacheck: 15.117582ms
INFO[0000] Workers idle times: #1: 8.572497ms, #3: 13.38068ms, #4: 13.37371ms
INFO[0000] processing took 167.02µs with stages: max_same_issues: 163.107µs, max_from_linter: 1.24µs, path_prettifier: 970ns, diff: 838ns, exclude: 452ns, cgo: 246ns, max_per_file_from_linter: 67ns, uniq_by_line: 51ns, nolint: 49ns
Congrats! No issues were found.
INFO[0000] Extracting issued lines took 0s
INFO[0000] Memory: 1 samples, avg is 15.3MB, max is 15.3MB
INFO[0000] Execution took 21.079892ms

Shouldn't "/tmp/blank.go:1:1: expected 'package', found 'EOF'" be considered as an issue?

@golangci golangci added the bug Something isn't working label May 29, 2018
golangci pushed a commit that referenced this issue May 29, 2018
…packages-to-program-linters

#33: don't pass not compiling packages to linters accepting loader.Pr…
@golangci
Copy link
Collaborator

thank you for the report!
fixed in #38, check please in master:
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

@quantonganh
Copy link
Author

It's ok now:

INFO[0000] Concurrency: 4, machine cpus count: 4
INFO[0000] Active linters: [govet deadcode structcheck varcheck ineffassign typecheck errcheck megacheck gas]
INFO[0000] set GOROOT="/usr/local/Cellar/go/1.10.1/libexec"
INFO[0000] Found paths for analysis for 72.387µs: [blank.go]
INFO[0000] Program loading took 1.474888ms
INFO[0000] SSA repr building took 14.303µs
INFO[0000] worker.3 took 765.727µs with stages: gas: 747.482µs, structcheck: 5.467µs, deadcode: 5.452µs
INFO[0000] worker.1 took 771.714µs with stages: ineffassign: 680.54µs, errcheck: 61.05µs, typecheck: 13.554µs, varcheck: 2.061µs
INFO[0000] worker.4 took 1.562359ms with stages: govet: 1.556615ms
INFO[0000] Can't process result by nolint processor: can't filter issue result.Issue{FromLinter:"typecheck", Text:"expected 'package', found 'EOF'", Pos:token.Position{Filename:"blank.go", Offset:0, Line:1, Column:1}, LineRange:result.Range{From:0, To:0}, HunkPos:0}: can't parse file blank.go
blank.go:1:1: expected 'package', found 'EOF' (typecheck)

^
INFO[0000] worker.2 took 2.784486ms with stages: megacheck: 2.759468ms
INFO[0000] processing took 875.653µs with stages: nolint: 716.23µs, exclude: 100.895µs, path_prettifier: 33.416µs, uniq_by_line: 11.442µs, max_same_issues: 7.82µs, max_per_file_from_linter: 2.323µs, max_from_linter: 1.718µs, cgo: 1.081µs, diff: 728ns
INFO[0000] Found 1 issues
INFO[0000] Extracting issued lines took 64.471µs
INFO[0000] Workers idle times: #1: 1.873388ms, #3: 1.893345ms, #4: 1.095593ms
INFO[0000] Memory: 1 samples, avg is 15.5MB, max is 15.5MB
INFO[0000] Execution took 84.253742ms

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

1 participant