Skip to content

Panic, from staticcheck #369

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

Closed
danielsaul opened this issue Jan 22, 2019 · 2 comments
Closed

Panic, from staticcheck #369

danielsaul opened this issue Jan 22, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@danielsaul
Copy link

Thank you for creating the issue!

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
    golangci-lint has version 1.13 built from 2192097 on 2019-01-21T07:58:24Z

  2. Config file: cat .golangci.yml

run:
  skip-dirs:
    - vendor
    - build
    - sql
    - tmp
  tests: false  # Exclude test files for the moment, until tests sorted out
linters:
  enable-all: false
  disable-all: false
  enable:
    - golint
    - govet
    - errcheck
    - staticcheck
    - unused
    - gosimple
    - structcheck
    - varcheck
    - ineffassign
    - deadcode
    - typecheck
    - gosec
    - interfacer
    - unconvert
    - goconst
    - goimports
    - misspell
    - lll
    - unparam
    - gocritic
    - gochecknoinits
linters-settings:
  misspell:
    locale: UK
issues:
  exclude:
    # Currently use 'org' and 'user' strings in ctx, fix eventually
    - 'should not use basic type string as key in context.WithValue'
  1. Go environment: go version && go env
o version go1.11.4 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/daniel/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/daniel/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zl/9fxgtwqs4s12xgn29f5dmv_m0000gn/T/go-build926679042=/tmp/go-build -gno-record-gcc-switches -fno-common"
  1. Verbose output of running: golangci-lint run -v
    (Leaving out linter issues)
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 21 linters: [deadcode errcheck gochecknoinits goconst gocritic goimports golint gosec gosimple govet ineffassign interfacer lll misspell staticcheck structcheck typecheck unconvert unparam unused varcheck]
INFO [lintersdb] Optimized sublinters [staticcheck gosimple unused] into metalinter megacheck
INFO [loader] Go packages loading at mode load deps types and syntax took 2.06760183s
INFO [loader] SSA repr building timing: packages building 18.389439ms, total 322.392955ms
INFO [loader] Packages that do not compile: [xxx]
INFO [runner] worker.3 took 814.222874ms with stages: goimports: 434.063545ms, gosec: 245.960478ms, misspell: 61.740686ms, govet: 42.810363ms, unconvert: 17.256514ms, deadcode: 7.19693ms, structcheck: 5.118471ms, gochecknoinits: 34.175µs
INFO [runner] worker.2 took 851.747659ms with stages: unparam: 307.428505ms, interfacer: 248.139499ms, gocritic: 152.531317ms, ineffassign: 108.205979ms, goconst: 14.812647ms, varcheck: 9.840484ms, lll: 7.525051ms, errcheck: 3.141509ms, typecheck: 18.485µs

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x1744b85]

goroutine 4749 [running]:
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck.(*Checker).CheckDeprecated.func1(0x1aed2e0, 0xc00ce25240, 0x1aecf01)
	/Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck/lint.go:2415 +0xf5
go/ast.inspector.Visit(0xc0232ca000, 0x1aed2e0, 0xc00ce25240, 0x1aea620, 0xc0232ca000)
	/usr/local/go/src/go/ast/walk.go:373 +0x3a
go/ast.Walk(0x1aea620, 0xc0232ca000, 0x1aed2e0, 0xc00ce25240)
	/usr/local/go/src/go/ast/walk.go:52 +0x66
go/ast.Walk(0x1aea620, 0xc0232ca000, 0x1aeca20, 0xc00ce1f300)
	/usr/local/go/src/go/ast/walk.go:136 +0x1033
go/ast.Walk(0x1aea620, 0xc0232ca000, 0x1aecce0, 0xc00efd3cb0)
	/usr/local/go/src/go/ast/walk.go:196 +0x1b12
go/ast.walkStmtList(0x1aea620, 0xc0232ca000, 0xc0096be000, 0x24, 0x40)
	/usr/local/go/src/go/ast/walk.go:32 +0x9e
go/ast.Walk(0x1aea620, 0xc0232ca000, 0x1aec9a0, 0xc00ce267b0)
	/usr/local/go/src/go/ast/walk.go:224 +0x1b67
go/ast.Walk(0x1aea620, 0xc0232ca000, 0x1aece20, 0xc00ce267e0)
	/usr/local/go/src/go/ast/walk.go:344 +0xd6d
go/ast.walkDeclList(0x1aea620, 0xc0232ca000, 0xc0084783e0, 0x2, 0x2)
	/usr/local/go/src/go/ast/walk.go:38 +0x9e
go/ast.Walk(0x1aea620, 0xc0232ca000, 0x1aecda0, 0xc011e09680)
	/usr/local/go/src/go/ast/walk.go:353 +0x2656
go/ast.Inspect(0x1aecda0, 0xc011e09680, 0xc0232ca000)
	/usr/local/go/src/go/ast/walk.go:385 +0x4b
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck.(*Checker).CheckDeprecated(0xc01f1f3fe0, 0xc022839c20)
	/Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck/lint.go:2448 +0xe6
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck.(*Checker).CheckDeprecated-fm(0xc022839c20)
	/Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/staticcheck/lint.go:242 +0x34
github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*Linter).Lint.func1(0xc01042c1d0, 0xc020ddb6e0, 0xc022839c20)
	/Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:462 +0xd8
created by github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint.(*Linter).Lint
	/Users/denis/go/src/github.com/golangci/golangci-lint/vendor/github.com/golangci/go-tools/lint/lint.go:453 +0x1d7e
@jirfag
Copy link
Contributor

jirfag commented Jan 26, 2019

hi, thank you for repoting!
I've workarounded it in v1.13.1: now it prints warnings but doesn't crash. Please don't close the issue

jirfag added a commit that referenced this issue Apr 21, 2019
The bug was introduced in golangci-lint when migrating staticcheck to go/packages.
Also, thanks to pkg.IllTyped we can analyze as max as we can by
staticcheck.

Relates: #418, #369, #429, #489
jirfag added a commit that referenced this issue Apr 21, 2019
The bug was introduced in golangci-lint when migrating staticcheck to go/packages.
Also, thanks to pkg.IllTyped we can analyze as max as we can by
staticcheck.

Relates: #418, #369, #429, #489
@jirfag
Copy link
Contributor

jirfag commented Apr 21, 2019

I've fixed it in #507, please, check.

@tpounds tpounds added the bug Something isn't working label Sep 25, 2019
@jirfag jirfag closed this as completed Oct 15, 2019
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