Skip to content

Panic when analyzing package #972

Closed
Closed

Description

@dominikh
git clone https://github.com/IBM/go-sdk-core/
cd go-sdk-core/v5
git checkout mdk/empty-body # this is commit 18e9a9b1a12c0418509cd8db49746869b5fe1f46 at time of writing
GOOS=linux GOARCH=amd64 staticcheck -tags=all ./...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x747415]

goroutine 643 [running]:
honnef.co/go/tools/analysis/report.getRange(0x7f7fb8331380, 0xc0010e2c60, 0xc001d7ab00, 0xc003169bf8, 0xc000790000)
	/home/dominikh/prj/src/honnef.co/go/tools/analysis/report/report.go:136 +0xf5
honnef.co/go/tools/analysis/report.Related.func1(0xc001d7ab00)
	/home/dominikh/prj/src/honnef.co/go/tools/analysis/report/report.go:47 +0x56
honnef.co/go/tools/analysis/report.Report(0xc000ded450, 0x9f4d00, 0xc0035a5ab0, 0xc002b3e320, 0x1d, 0xc003169d68, 0x1, 0x1)
	/home/dominikh/prj/src/honnef.co/go/tools/analysis/report/report.go:150 +0x6d
honnef.co/go/tools/staticcheck.CheckTypedNilInterface(0xc000ded450, 0x145e6683, 0xc5ca60, 0xc000ded3e8, 0x0)
	/home/dominikh/prj/src/honnef.co/go/tools/staticcheck/lint.go:4420 +0xb0d
honnef.co/go/tools/lintcmd/runner.(*analyzerRunner).do(0xc002093fb0, 0xa00f18, 0xc00208e320, 0x0, 0x0)
	/home/dominikh/prj/src/honnef.co/go/tools/lintcmd/runner/runner.go:938 +0x61b
honnef.co/go/tools/lintcmd/runner.genericHandle(0xa00f18, 0xc00208e320, 0xa00f18, 0xc0018f6320, 0xc0009e9c20, 0xc00030a0b8, 0xc00204cb10)
	/home/dominikh/prj/src/honnef.co/go/tools/lintcmd/runner/runner.go:763 +0x196
created by honnef.co/go/tools/lintcmd/runner.(*subrunner).runAnalyzers
	/home/dominikh/prj/src/honnef.co/go/tools/lintcmd/runner/runner.go:1004 +0x5ca

Activity

  1. dominikh commented on Apr 25, 2021

    @dominikh
    OwnerAuthor

    Basic reproduction case:

    package pkg
    
    func fn() {
    	var x interface{} = (map[string]int)(nil)
    	_ = x == nil
    }
    
  2. added a commit that references this issue on Apr 8, 2024
    fc139a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions