Skip to content

panic: nil underlying #1410

Closed
Closed

Description

@karlik8899

staticcheck 2023.1.3 (v0.4.3)

Compiled with Go version: go1.20.2
Main module:
honnef.co/go/tools@v0.4.3 (sum: h1:o/n5/K5gXqk8Gozvs2cnL0F2S1/g1vcGCAx2vETjITw=)
Dependencies:
github.com/BurntSushi/toml@v1.2.1 (sum: h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=)
golang.org/x/exp/typeparams@v0.0.0-20221208152030-732eee02a75a (sum: h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE=)
golang.org/x/mod@v0.7.0 (sum: h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=)
golang.org/x/sys@v0.3.0 (sum: h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=)
golang.org/x/tools@v0.4.1-0.20221208213631-3f74d914ae6d (sum: h1:9ZNWAi4CYhNv60mXGgAncgq7SGc5qa7C8VZV8Tg7Ggs=)

env:

Details

go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOOS="linux"
GOPROXY="https://proxy.golang.org"
GOROOT="/opt/go1.20.2"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go1.20.2/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1949918171=/tmp/go-build -gno-record-gcc-switches"

I have code:

Details
package main

import (
"fmt"
"github.com/seancfoley/ipaddress-go/ipaddr"
)

type DB struct {
Net *ipaddr.IPAddress
}

func main() {
fmt.Println("XXX")
}

If I run staticcheck it is OK

If I add test file xx_test:

Details
cat main_test.go
package main

import (
"fmt"
"testing"
)

func TestOne(t *testing.T) {
fmt.Println("x")
}

and run a staticcheck, I get:

Details
panic: nil underlying

goroutine 173 [running]:
go/types.(*Named).under(0xc0001378f0)
/opt/go1.20.2/src/go/types/named.go:494 +0x3d8
go/types.under({0xa0b158?, 0xc0001378f0?})
/opt/go1.20.2/src/go/types/type.go:23 +0x45
go/types.computeInterfaceTypeSet(0x0, 0xc0002c4d90?, 0xc000714ff0)
/opt/go1.20.2/src/go/types/typeset.go:273 +0x3f0
go/types.(*TypeParam).iface(0xc000524ae0)
/opt/go1.20.2/src/go/types/typeparam.go:140 +0x1b2
go/types.(*TypeParam).SetConstraint(...)
/opt/go1.20.2/src/go/types/typeparam.go:88
golang.org/x/tools/internal/gcimporter.(*reader).typeParamNames.func1()
/home/karlik/go/pkg/mod/golang.org/x/tools@v0.4.1-0.20221208213631-3f74d914ae6d/internal/gcimporter/ureader_yes.go:688 +0x45
golang.org/x/tools/internal/gcimporter.readUnifiedPackage(0xc00028e100, 0x0, 0xc0004a4150, {0x1, 0x0, {0xc0000e62d0, 0x1}, {0xc0004c087c, 0x5bcf7}, {0xc00025a000, ...}, ...})
/home/karlik/go/pkg/mod/golang.org/x/tools@v0.4.1-0.20221208213631-3f74d914ae6d/internal/gcimporter/ureader_yes.go:117 +0x483
golang.org/x/tools/internal/gcimporter.UImportData(0xa09720?, 0xc000434018?, {0xc00091e001?, 0x67f4bf?, 0x1010000000000?}, {0xc0000e62d0, 0x1})
/home/karlik/go/pkg/mod/golang.org/x/tools@v0.4.1-0.20221208213631-3f74d914ae6d/internal/gcimporter/ureader_yes.go:68 +0x10a
golang.org/x/tools/go/gcexportdata.Read({0xa09720?, 0xc000434018?}, 0x0?, 0x30?, {0xc0000e62d0, 0x1})
/home/karlik/go/pkg/mod/golang.org/x/tools@v0.4.1-0.20221208213631-3f74d914ae6d/go/gcexportdata/gcexportdata.go:134 +0x2b0
honnef.co/go/tools/go/loader.(*program).loadFromExport(0xc000411a60, 0xc0001d7680)
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/go/loader/loader.go:199 +0xed
honnef.co/go/tools/go/loader.Load(0xc00020dcc0)
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/go/loader/loader.go:168 +0x166
honnef.co/go/tools/lintcmd/runner.(*subrunner).doUncached(0x0?, 0xc000242b40)
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/lintcmd/runner/runner.go:694 +0x7f
honnef.co/go/tools/lintcmd/runner.(*subrunner).do(0xc00054e780, {0xa0dae0?, 0xc000242b40})
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/lintcmd/runner/runner.go:577 +0x94e
honnef.co/go/tools/lintcmd/runner.(*Runner).Run.func2({0xa0dae0?, 0xc000242b40?})
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/lintcmd/runner/runner.go:1268 +0x30
honnef.co/go/tools/lintcmd/runner.genericHandle({0xa0dae0?, 0xc000242b40}, {0xa0dae0?, 0xc000131200?}, 0x0?, 0xc0001ea190, 0xc0004116c0)
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/lintcmd/runner/runner.go:817 +0x130
created by honnef.co/go/tools/lintcmd/runner.(*Runner).Run
/home/karlik/go/pkg/mod/honnef.co/go/tools@v0.4.3/lintcmd/runner/runner.go:1267 +0x512

Activity

  1. added
    needs-triage
    on Jun 2, 2023
  2. added
    upstream
    and removed
    needs-triage
    on Jun 2, 2023
  3. added a commit that references this issue on Aug 17, 2023
    9fae04b
  4. added a commit that references this issue on Feb 27, 2024
    faac3c4
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

    bugupstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions