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

Panic: execinquery: package "device" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 7709 #2851

Closed
4 tasks done
davix opened this issue May 13, 2022 · 8 comments · Fixed by openshift/release#48804
Labels
bug Something isn't working

Comments

@davix
Copy link

davix commented May 13, 2022

Welcome

  • 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).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

It panics.
device is one of the packages in project.
Before upgrading to go1.18 and latest golangci-lint, no this issue.

Even though I put //nolint in the package, or skip the files ".device_control." of the package, the panic is the same.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.46.1 built from 044f0a17 on 2022-05-12T09:23:45Z

Configuration file

$ cat .golangci.yml
# options for analysis running
run:
  # timeout for analysis, e.g. 30s, 5m, default is 1m
  timeout: 5m
  # exit code when at least one issue was found, default is 1
  issues-exit-code: 1

  # default is true. Enables skipping of directories:
  #   vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
  skip-dirs-use-default: true
  # which files to skip: they will be analyzed, but issues from them
  # won't be reported. Default value is empty list, but there is
  # no need to include all autogenerated files, we confidently recognize
  # autogenerated files. If it's not please let us know.
  # "/" will be replaced by current OS file path separator to properly work
  # on Windows.
  skip-files:
    - ".*_test.go"
    - ".*pb.go"
    - ".*device_control.*"
linters:
  enable-all: true
  disable:
    - golint
    - interfacer
    - maligned
    - scopelint
    - cyclop
    - exhaustive
    - exhaustivestruct
    - funlen
    - gci
    - ireturn
    - lll
    - nlreturn
    - varnamelen
    - wsl
    - wrapcheck
    - gochecknoglobals
    - goerr113
    - gochecknoinits
    - tagliatelle
    - promlinter
    - bodyclose
    - contextcheck
    - gosimple
    - nilerr
    - noctx
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - structcheck
    - stylecheck
    - tparallel
    - unparam
    - wastedassign
    - unused
linters-settings:
  staticcheck:
    go: "1.18"
    checks: [ "all" ]
  stylecheck:
    go: "1.18"
    initialisms: [ "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "IP", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS" ]
  gocognit:
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
    min-complexity: 25
  revive:
    ignoreGeneratedHeader: false
    severity: warning
    confidence: 0.8
    errorCode: 0
    warningCode: 0
    # specific enabled rules are recommended default
    enableAllRules: true
    rules:
      - name: var-naming
        arguments: [["ID", "JSON", "UUID"]]
      - name: blank-imports
      - name: context-as-argument
      - name: context-keys-type
      - name: dot-imports
      - name: error-return
      - name: error-strings
      - name: error-naming
      - name: exported
      - name: if-return
      - name: increment-decrement
      - name: var-declaration
      - name: package-comments
      - name: range
      - name: receiver-naming
      - name: time-naming
      - name: unexported-return
      - name: indent-error-flow
      - name: errorf
      - name: empty-block
      - name: superfluous-else
      - name: unused-parameter
      - name: unreachable-code
      - name: redefines-builtin-id

Go environment

$ go version && go env
go version go1.18.2 darwin/amd64
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/whuang/Library/Caches/go-build"
GOENV="/Users/whuang/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/whuang/go/pkg/mod"
GONOPROXY="stash.arubanetworks.com"
GONOSUMDB="stash.arubanetworks.com"
GOOS="darwin"
GOPATH="/Users/whuang/go"
GOPRIVATE="stash.arubanetworks.com"
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/whuang/code/ii/cmdgw/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sl/9zn0ht317s52y6vyqtc3gt6m0000gn/T/go-build3215327970=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
 golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/whuang/code/ii/cmdgw /Users/whuang/code/ii /Users/whuang/code /Users/whuang /Users /] 
INFO [config_reader] Used config file .golangci.yml 
INFO [lintersdb] Active 58 linters: [asciicheck bidichk containedctx deadcode decorder depguard dogsled dupl durationcheck errcheck errchkjson errname errorlint execinquery exhaustruct exportloopref forbidigo forcetypeassert gocognit goconst gocritic gocyclo godot godox gofmt gofumpt goheader goimports gomnd gomoddirectives gomodguard goprintffuncname gosec govet grouper ifshort importas ineffassign maintidx makezero misspell nakedret nestif nilnil nolintlint nonamedreturns nosprintfhostport paralleltest prealloc predeclared revive tenv testpackage thelper typecheck unconvert varcheck whitespace] 
INFO [loader] Go packages loading at mode 575 (compiled_files|exports_file|imports|name|deps|files|types_sizes) took 1.589838281s 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 88.615343ms 
INFO [linters context] importas settings found, but no aliases listed. List aliases under alias: key. 
INFO [linters context/goanalysis] analyzers took 1m5.760811268s with top 10 stages: gofumpt: 6.407679617s, dupl: 6.329387448s, goimports: 5.786751878s, gocritic: 4.584845539s, the_only_name: 4.323575333s, bidichk: 3.773012111s, gosec: 3.768876143s, errorlint: 3.488655688s, gofmt: 2.927540314s, forbidigo: 2.85532456s 
ERRO [runner] Panic: execinquery: package "device" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 7771 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155
panic({0x1af2ca0, 0x2511360})
        runtime/panic.go:838 +0x207
go/types.(*Package).Path(...)
        go/types/package.go:31
github.com/lufeee/execinquery.linter.run.func1({0x1e64ba0?, 0xc00478cec0})
        github.com/lufeee/execinquery@v1.2.0/execinquery.go:52 +0xbe
golang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc010374108, {0xc0032984e0?, 0x1?, 0xc000066480?}, 0xc0179e7cf0)
        golang.org/x/tools@v0.1.11-0.20220316014157-77aa08bb151a/go/ast/inspector/inspector.go:77 +0x9a
github.com/lufeee/execinquery.linter.run({0xc0008a4500?, 0xc0008a4640?}, 0xc02d8d5040)
        github.com/lufeee/execinquery@v1.2.0/execinquery.go:44 +0xd5
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc002d92200)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0016be640, {0x1c5ecd6, 0xb}, 0xc003298748)
        github.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc000309500?)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc002d92200)
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        github.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: execinquery: package "device" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference 
INFO [runner] processing took 175.287µs with stages: max_same_issues: 170.951µs, filename_unadjuster: 463ns, skip_dirs: 460ns, max_from_linter: 411ns, cgo: 361ns, nolint: 340ns, source_code: 216ns, exclude-rules: 210ns, max_per_file_from_linter: 200ns, path_prettifier: 193ns, autogenerated_exclude: 192ns, skip_files: 191ns, exclude: 186ns, uniq_by_line: 181ns, diff: 167ns, sort_results: 127ns, path_shortener: 121ns, path_prefixer: 113ns, identifier_marker: 106ns, severity-rules: 98ns 
INFO [runner] linters took 11.433858618s with stages: goanalysis_metalinter: 11.43299908s 
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: goanalysis_metalinter: execinquery: package "device" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference
 
INFO Memory: 119 samples, avg is 508.2MB, max is 994.8MB 
INFO Execution took 13.132274881s                 

Code example or link to a public repository

//nolint
package device
@davix davix added the bug Something isn't working label May 13, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented May 13, 2022

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

@gofort
Copy link

gofort commented May 13, 2022

The same thing for me, "clients" is also one of the projects packages

task: [analysis] golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ /drone/src /drone / /root]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[lintersdb] Active 68 linters: [asciicheck bidichk bodyclose containedctx contextcheck deadcode decorder depguard dogsled dupl durationcheck errcheck errchkjson errname errorlint execinquery exhaustruct exportloopref forcetypeassert funlen gochecknoglobals gochecknoinits gocognit goconst gocritic gocyclo goerr113 gofmt goheader goimports gomnd gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper importas ineffassign lll maintidx makezero misspell nakedret nestif nilnil nonamedreturns nosprintfhostport prealloc predeclared promlinter revive rowserrcheck sqlclosecheck staticcheck structcheck stylecheck tenv testpackage tparallel typecheck unconvert unparam unused varcheck wastedassign wrapcheck]"
level=info msg="[loader] Go packages loading at mode 575 (compiled_files|deps|name|exports_file|files|imports|types_sizes) took 13.926365791s"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 68.237288ms"
level=info msg="[linters context] importas settings found, but no aliases listed. List aliases under alias: key."
level=info msg="[linters context/goanalysis] analyzers took 9m51.340389632s with top 10 stages: buildir: 1m33.412982037s, bidichk: 37.199475009s, the_only_name: 25.247269466s, gosec: 22.964066203s, wastedassign: 21.406397499s, buildssa: 18.664457816s, dupl: 16.004535286s, directives: 15.382297001s, gochecknoglobals: 13.884885759s, mnd: 13.67941852s"
level=error msg="[runner] Panic: execinquery: package \"clients\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 10138 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155\npanic({0xef29c0, 0x190af10})\n\truntime/panic.go:838 +0x207\ngo/types.(*Package).Path(...)\n\tgo/types/package.go:31\ngithub.com/lufeee/execinquery.linter.run.func1({0x12641a0?, 0xc00e53f4c0})\n\tgithub.com/lufeee/execinquery@v1.2.0/execinquery.go:52 +0xbe\ngolang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc011a2a330, {0xc003b44ce0?, 0x1?, 0x0?}, 0xc000851cf0)\n\tgolang.org/x/tools@v0.1.11-0.20220316014157-77aa08bb151a/go/ast/inspector/inspector.go:77 +0x9a\ngithub.com/lufeee/execinquery.linter.run({0xc000236a00?, 0xc0000f6000?}, 0xc00e546340)\n\tgithub.com/lufeee/execinquery@v1.2.0/execinquery.go:44 +0xd5\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc002cee200)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1d\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc001ea4780, {0x105deea, 0xb}, 0xc003b44f48)\n\tgithub.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x85\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc002cee200)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb\n"
level=warning msg="[runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: execinquery: package \"clients\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference"
level=info msg="[runner] processing took 6.667µs with stages: max_same_issues: 2.69µs, skip_dirs: 747ns, max_from_linter: 490ns, nolint: 368ns, cgo: 355ns, uniq_by_line: 308ns, exclude: 268ns, path_prettifier: 258ns, filename_unadjuster: 166ns, skip_files: 160ns, autogenerated_exclude: 150ns, max_per_file_from_linter: 147ns, source_code: 80ns, identifier_marker: 76ns, diff: 74ns, severity-rules: 71ns, path_shortener: 69ns, sort_results: 68ns, exclude-rules: 67ns, path_prefixer: 55ns"
level=info msg="[runner] linters took 19.386817096s with stages: goanalysis_metalinter: 19.386726114s"
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: goanalysis_metalinter: execinquery: package \"clients\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference\n\n"
level=info msg="Memory: 329 samples, avg is 453.0MB, max is 1445.1MB"
level=info msg="Execution took 33.395468883s"
task: Failed to run task "analysis": exit status 3

@adylanrff
Copy link

Same thing happened to me when using the Github Action.

Logs

level=error msg="[runner] Panic: execinquery: package \"common\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 5470 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155\npanic({0xef[29](https://github.com/Deciseeo/thecisio-backend/runs/6419500434?check_suite_focus=true#step:4:29)c0, 0x190af10})\n\truntime/panic.go:838 +0x207\ngo/types.(*Package).Path(...)\n\tgo/types/package.go:31\ngithub.com/lufeee/execinquery.linter.run.func1({0x12641a0?, 0xc0008c96c0})\n\tgithub.com/lufeee/execinquery@v1.2.0/execinquery.go:52 +0xbe\ngolang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc002b339f8, {0xc002ef0ce0?, 0x1?, 0xc001b04b80?}, 0xc001527cf0)\n\tgolang.org/x/tools@v0.1.11-0.20220316014157-77aa08bb151a/go/ast/inspector/inspector.go:77 +0x9a\ngithub.com/lufeee/execinquery.linter.run({0xc000cb0320?, 0xc000cb0460?}, 0xc0009ea680)\n\tgithub.com/lufeee/execinquery@v1.2.0/execinquery.go:44 +0xd5\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc002986c20)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1d\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0013417c0, {0x105deea, 0xb}, 0xc002ef0f48)\n\tgithub.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:104 +0x85\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc002986c20)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb\n"

Github Action

  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-go@v3
        with:
          go-version: 1.17
      - uses: actions/checkout@v3
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3

@ldez
Copy link
Member

ldez commented May 13, 2022

Hello,

it's a problem with execinqeury, and I have already created a fix 1uf3/execinquery#13

As workaround, you can disable execinquery:

linters:
  disable:
    - execinquery

@ldez ldez closed this as completed May 13, 2022
@w3irdrobot
Copy link

@ldez thanks for getting that PR into execinquery. what does getting that fix to run in golangci-lint look like? does a new release need to be cut?

@ldez
Copy link
Member

ldez commented May 13, 2022

I'm waiting for a tag of execinquery

@lzap
Copy link

lzap commented Aug 10, 2022

Guys, was this resolved or not? We are pinned to 1.45.2 for the moment, which version carries the fix?

@ldez
Copy link
Member

ldez commented Aug 10, 2022

https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md#v1462

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

Successfully merging a pull request may close this issue.

6 participants