Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in the ir.(*Program).needMethods with v5.0 #1587

Open
hawkingrei opened this issue Aug 14, 2024 · 5 comments
Open

Panic in the ir.(*Program).needMethods with v5.0 #1587

hawkingrei opened this issue Aug 14, 2024 · 5 comments
Labels
bug waiting-for-feedback Waiting for the user to get back to us

Comments

@hawkingrei
Copy link

hawkingrei commented Aug 14, 2024

ERROR: /root/.cache/bazel/_bazel_root/37ff7b0eddea115f60ab9f853788d7f5/external/com_github_google_renameio_v2/BUILD.bazel:3:11: GoCompilePkg external/com_github_google_renameio_v2/renameio.a failed: (Exit 1): builder failed: error executing command (from target @com_github_google_renameio_v2//:renameio) bazel-out/k8-opt-exec-2B5CBBC6-ST-00bca8d33aad/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64_race -tags race -src ... (remaining 31 arguments skipped)
compilepkg: panic: internal error: unhandled case *types.Alias
goroutine 552 [running]:
honnef.co/go/tools/analysis/lint.ExhaustiveTypeSwitch(...)
	external/co_honnef_go_tools/analysis/lint/lint.go:242
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0010422a0, {0x4f5788, 0xc001113c80}, 0x0)
	external/co_honnef_go_tools/go/ir/methods.go:239 +0x579
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0010422a0, {0x4f5710, 0xc00069ff20}, 0x0)
	external/co_honnef_go_tools/go/ir/methods.go:235 +0x687
honnef.co/go/tools/go/ir.(*Program).needMethods(0xc0010422a0, {0x4f5738, 0xc001078a80}, 0x0)
	external/co_honnef_go_tools/go/ir/methods.go:211 +0x419
honnef.co/go/tools/go/ir.(*Program).needMethodsOf(0xc0010422a0, {0x4f5738?, 0xc001078a80?})
	external/co_honnef_go_tools/go/ir/methods.go:148 +0x70
honnef.co/go/tools/go/ir.(*Package).build(0xc000b30c60)
	external/co_honnef_go_tools/go/ir/builder.go:2579 +0xf6
sync.(*Once).doSlow(0xc0010422a0?, 0xc0003577a0?)
	bazel-out/k8-opt-exec-2B5CBBC6-ST-e4bf93cdf86e/bin/external/io_bazel_rules_go/stdlib_/src/sync/once.go:76 +0xb4
sync.(*Once).Do(...)
	bazel-out/k8-opt-exec-2B5CBBC6-ST-e4bf93cdf86e/bin/external/io_bazel_rules_go/stdlib_/src/sync/once.go:67
honnef.co/go/tools/go/ir.(*Package).Build(...)
	external/co_honnef_go_tools/go/ir/builder.go:2567
honnef.co/go/tools/internal/passes/buildir.run(0xc0010421c0)
	external/co_honnef_go_tools/internal/passes/buildir/buildir.go:86 +0x18b
main.(*action).execOnce(0xc000b6c3c0)
	external/io_bazel_rules_go/go/tools/builders/nogo_main.go:354 +0x8b7
sync.(*Once).doSlow(0x0?, 0x0?)
	bazel-out/k8-opt-exec-2B5CBBC6-ST-e4bf93cdf86e/bin/external/io_bazel_rules_go/stdlib_/src/sync/once.go:76 +0xb4
sync.(*Once).Do(...)
	bazel-out/k8-opt-exec-2B5CBBC6-ST-e4bf93cdf86e/bin/external/io_bazel_rules_go/stdlib_/src/sync/once.go:67
main.(*action).exec(...)
	external/io_bazel_rules_go/go/tools/builders/nogo_main.go:281
main.execAll.func1(0x0?)
	external/io_bazel_rules_go/go/tools/builders/nogo_main.go:275 +0x65
created by main.execAll in goroutine 437
	external/io_bazel_rules_go/go/tools/builders/nogo_main.go:273 +0x48
ERROR: /home/prow/go/src/github.com/pingcap/tidb/tests/realtikvtest/importintotest/BUILD.bazel:3:8 GoCompilePkgExternal tests/realtikvtest/importintotest/importintotest_test_test.external.a failed: (Exit 1): builder failed: error executing command (from target @com_github_google_renameio_v2//:renameio) bazel-out/k8-opt-exec-2B5CBBC6-ST-00bca8d33aad/bin/external/go_sdk/builder_reset/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64_race -tags race -src ... (remaining 31 arguments skipped) 

https://tiprow.hawkingrei.com/view/gs/pingcapprow/pr-logs/pull/pingcap_tidb/51126/fast_test_tiprow/1823540729058693120

@hawkingrei hawkingrei added bug needs-triage Newly filed issue that needs triage labels Aug 14, 2024
@hawkingrei
Copy link
Author

It runs with go1.23

@dominikh
Copy link
Owner

Please provide

  • The output of 'staticcheck -debug.version'
  • The output of 'go version' (outside of any Go module)
  • The output of 'go env'

@dominikh dominikh added waiting-for-feedback Waiting for the user to get back to us and removed needs-triage Newly filed issue that needs triage labels Aug 14, 2024
@EsterfanoLopes
Copy link

EsterfanoLopes commented Aug 15, 2024

Same here. Does not look to be a problem with go 1.22.6 though. The given panics only appears when running go 1.23.0

staticcheck -debug.version

staticcheck 2024.1.1 (0.5.1)

Compiled with Go version: go1.23.0
Main module:
        honnef.co/go/[email protected] (sum: h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=)
Dependencies:
        github.com/BurntSushi/[email protected] (sum: h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=)
        golang.org/x/exp/[email protected] (sum: h1:1P7xPZEwZMoBoz0Yze5Nx2/4pxj6nw9ZqHWXqP0iRgQ=)
        golang.org/x/[email protected] (sum: h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=)
        golang.org/x/[email protected] (sum: h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=)
        golang.org/x/[email protected] (sum: h1:SHq4Rl+B7WvyM4XODon1LXtP7gcG49+7Jubt1gWWswY=)

go version
go version go1.23.0 darwin/arm64

go env

GO111MODULE=''
GOARCH='arm64'
GOBIN='/Users/esterfano.lopes/go/bin'
GOCACHE='/Users/esterfano.lopes/Library/Caches/go-build'
GOENV='/Users/esterfano.lopes/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/esterfano.lopes/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/esterfano.lopes/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/esterfano.lopes/sdk/go1.23.0'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/esterfano.lopes/sdk/go1.23.0/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/esterfano.lopes/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/esterfano.lopes/Development/motain/news/go.mod'
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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/6d/_lcfw1qd03d822wbyxv7dj800000gq/T/go-build1989325247=/tmp/go-build -gno-record-gcc-switches -fno-common'

@lesiw
Copy link

lesiw commented Aug 15, 2024

This seems to be happening because of the new *types.Alias type.

By default, go/types now produces Alias type nodes for type aliases. This behavior can be controlled by the GODEBUG gotypesalias flag. Its default has changed from 0 in Go 1.22 to 1 in Go 1.23.

- Go 1.23 release notes

You should be able to work around it by setting GODEBUG=gotypesalias=0.

@dominikh
Copy link
Owner

It'd also be useful to have a minimal reproducer for this problem, because Staticcheck 2024.1 is supposed to handle the new type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug waiting-for-feedback Waiting for the user to get back to us
Projects
None yet
Development

No branches or pull requests

4 participants