Skip to content

gci runtime error #3018

@ejain

Description

@ejain

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

golangci-lint crashes with a nil pointer error, even though I can run [email protected] directly with the same option on the same code without any issues. If I disable gci in .golangci.yml, everything is fine.

Version of golangci-lint

v1.47.2

Configuration file

  ...
  gci:
    sections:
      - Std
      - Def
      - prefix(github.com/x/y)
  ...

Go environment

1.18.4

Verbose output of running

Running [/home/runner/golangci-lint-1.47.2-linux-amd64/golangci-lint run --out-format=github-actions --timeout=2m] in [] ...
  level=warning msg="[linters context] bodyclose is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
  level=error msg="[runner] Panic: gci: package \"env\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 7404 [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({0xf0a040, 0x1943970})\n\truntime/panic.go:838 +0x207\ngithub.com/golangci/golangci-lint/pkg/golinters.runGci(0xc006e32a90, 0xc001313dc0?, 0x0, 0xc0004b4890?)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/gci.go:89 +0x214\ngithub.com/golangci/golangci-lint/pkg/golinters.NewGci.func1.1(0xef8e80?)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/gci.go:61 +0x3b\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0031[23](https://github.com/bloomapi/bloomtext-backend/runs/7526089707?check_suite_focus=true#step:4:25)4b0)\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(0xc002a44960, {0x102dec8, 0x3}, 0xc001c20748)\n\tgithub.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0004f6cc0?)\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(0xc0031234b0)\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: gci: package \"env\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference"
  level=warning msg="[linters context] sqlclosecheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/2649."
  level=warning msg="[linters context] structcheck is disabled because of go1.18. You can track the evolution of the go1.18 support by following the https://github.com/golangci/golangci-lint/issues/[26](https://github.com/bloomapi/bloomtext-backend/runs/7526089707?check_suite_focus=true#step:4:28)49."
  level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: goanalysis_metalinter: gci: package \"env\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference\n\n"

Code example or link to a public repository

Details
// add your code here

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