Skip to content

Panic: execinquery: package "XXXXXX" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [0] with length 0: goroutine 10239 [running]: #2840

Closed
@ninadingole

Description

@ninadingole

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

The latest version 1.46.0 is causing issue in code which was previously working fine, the error is also not descriptive enough to understand if the problem is with the code or with the latest lib version

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.46.0 built from (unknown, mod sum: "h1:uz9AtEcIP63FH+FIyuAXcQGVQO4vCUavEsMTJpPeD4s=") on (unknown)

Configuration file

$ cat .golangci.yml
# See https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
run:
  tests: true
  deadline: 5m
  skip-dirs:
    - ci
    - terraform
    - vendor

linters-settings:
  errcheck:
    check-type-assertions: true
    check-blank: true
  gocyclo:
    min-complexity: 20
  cyclop:
    max-complexity: 15
  dupl:
    threshold: 200
  misspell:
    locale: US
  unused:
    check-exported: false
  unparam:
    check-exported: true
  revive:
    rules:
      - name: unexported-return
        disabled: true
  ireturn:
    allow:
      - stdlib
      - error
      - gomock.Matcher
      - trace.SpanExporter
  varnamelen:
    max-distance: 15
    ignore-names:
      - tx # this is for sql transaction
      - w # for http writer
      - r # for http request
  goconst:
    min-occurrences: 5

linters:
  enable-all: true
  disable:
    - maligned
    - gochecknoglobals
    - dogsled
    - misspell
    - testpackage
    - funlen
    - gocognit
    - goerr113
    - durationcheck
    - tparallel
    - scopelint
    - interfacer
    - golint
    - exhaustivestruct
    - revive
    - lll

issues:
  exclude-use-default: true
  exclude-rules:
    - path: cmd/main\.go
      linters:
        - gosec

    - path: _test\.go
      linters:
        - exhaustivestruct
        - wrapcheck
        - varnamelen
        - forcetypeassert
        - maintidx
    - path: pkg/apptest/.*\.go
      linters:
        - exhaustivestruct
        - wrapcheck
        - varnamelen
        - forcetypeassert
        - maintidx
    - path: tools/migrate.go
      linters:
        - varnamelen
    - path: pkg/reactivation/model.go
      linters:
        - tagliatelle

    - linters:
        - lll
      source: "^//go:generate "

Go environment

$ go version && go env
go version go1.17.8 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ninad/Library/Caches/go-build"
GOENV="/Users/ninad/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ninad/.gvm/pkgsets/go1.17.8/global"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/ninad/.gvm/gos/go1.17.8"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/ninad/.gvm/gos/go1.17.8/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.8"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ninad/projects/customer-plans-service/go.mod"
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/hx/8j7_r9ln6zxbnph3fpgjc7xm0000gn/T/go-build3707472432=/tmp/go-build -gno-record-gcc-switches -fno-common"

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
INFO [config_reader] Config search paths: [./ /Users/ninad/projects/customer-plans-service /Users/ninad/projects /Users/ninad /Users /]
INFO [config_reader] Used config file .github/linters/.golangci.yml
INFO [lintersdb] Active 76 linters: [asciicheck bidichk bodyclose containedctx contextcheck cyclop deadcode decorder depguard dupl errcheck errchkjson errname errorlint execinquery exhaustive exhaustruct exportloopref forbidigo forcetypeassert gci gochecknoinits goconst gocritic gocyclo godot godox gofmt gofumpt goheader goimports gomnd gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper ifshort importas ineffassign ireturn maintidx makezero nakedret nestif nilerr nilnil nlreturn noctx nolintlint nonamedreturns nosprintfhostport paralleltest prealloc predeclared promlinter rowserrcheck sqlclosecheck staticcheck structcheck stylecheck tagliatelle tenv thelper typecheck unconvert unparam unused varcheck varnamelen wastedassign whitespace wrapcheck wsl]
INFO [loader] Go packages loading at mode 575 (types_sizes|exports_file|imports|name|compiled_files|deps|files) took 777.575257ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 7.111696ms
INFO [linters context] importas settings found, but no aliases listed. List aliases under alias: key.
INFO [linters context/goanalysis] analyzers took 1m21.910202302s with top 10 stages: buildir: 27.564658125s, bidichk: 4.933651489s, exhaustive: 3.824811496s, buildssa: 3.824545894s, wastedassign: 3.315968262s, inspect: 1.917225238s, fact_deprecated: 1.740200355s, gocritic: 1.422711833s, printf: 1.380286329s, ctrlflow: 1.325833624s
ERRO [runner] Panic: execinquery: package "platform" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [0] with length 0: goroutine 10292 [running]:
runtime/debug.Stack()
	/Users/ninad/.gvm/gos/go1.17.8/src/runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:101 +0x155
panic({0x4c300e0, 0xc02077b1b8})
	/Users/ninad/.gvm/gos/go1.17.8/src/runtime/panic.go:1038 +0x215
github.com/lufeee/execinquery.run.func1({0x4ec7f00, 0xc004385dc0})
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/lufeee/[email protected]/execinquery.go:45 +0x3b5
golang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc01621dcc8, {0x0, 0x5696100, 0x1fab122804011667}, 0xc0018b3d40)
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/golang.org/x/[email protected]/go/ast/inspector/inspector.go:77 +0x86
github.com/lufeee/execinquery.run(0xc008113520)
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/lufeee/[email protected]/execinquery.go:27 +0x77
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc002f59540)
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:187 +0x9c4
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:105 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0000ca0a0, {0x4cd866e, 0xb}, 0xc00172ef60)
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc002f59540)
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:104 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0x0)
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0x67
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
	/Users/ninad/.gvm/pkgsets/go1.17.8/global/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1fd
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: execinquery: package "platform" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [0] with length 0
INFO [runner] processing took 266.955µs with stages: max_same_issues: 263.31µs, skip_dirs: 420ns, max_from_linter: 414ns, cgo: 408ns, nolint: 393ns, skip_files: 267ns, exclude: 199ns, identifier_marker: 162ns, path_prettifier: 160ns, source_code: 157ns, filename_unadjuster: 156ns, uniq_by_line: 156ns, autogenerated_exclude: 154ns, path_shortener: 100ns, diff: 87ns, sort_results: 86ns, max_per_file_from_linter: 84ns, exclude-rules: 81ns, path_prefixer: 81ns, severity-rules: 80ns
INFO [runner] linters took 7.168288842s with stages: goanalysis_metalinter: 7.167617253s
ERRO Running error: 1 error occurred:
	* can't run linter goanalysis_metalinter: goanalysis_metalinter: execinquery: package "platform" (isInitialPkg: true, needAnalyzeSource: true): runtime error: index out of range [0] with length 0

INFO Memory: 80 samples, avg is 423.5MB, max is 759.6MB
INFO Execution took 7.968912002s

Code example or link to a public repository

// add your code here

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions