Skip to content

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

Closed
openshift/release
#48804
@davix

Description

@davix

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/[email protected]/execinquery.go:52 +0xbe
golang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc010374108, {0xc0032984e0?, 0x1?, 0xc000066480?}, 0xc0179e7cf0)
        golang.org/x/[email protected]/go/ast/inspector/inspector.go:77 +0x9a
github.com/lufeee/execinquery.linter.run({0xc0008a4500?, 0xc0008a4640?}, 0xc02d8d5040)
        github.com/lufeee/[email protected]/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions