bazel-contrib / bazel-contrib/rules_go
nogo: unexpected container type in IndexExpr
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 760
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 12
Description
### What version of rules_go are you using?
`0.32.0`
### What version of gazelle are you using?
`0.25.0`
### What version of Bazel are you using?
`5.1.2`
### Does this issue reproduce with the latest releases of all the above?
Yes.
### What operating system and processor architecture are you using?
macos aarch64, also tested on Linux x86_64
### Any other potentially useful information about your toolchain?
Seems related to https://github.com/golang/go/issues/52834, but using `golang.org/x/tools v0.1.11-0.20220518213611-904e24e9fcf9` does not seem to make a difference.
### What did you do?
```starlark
nogo(
name = "nogo",
visibility = ["//visibility:public"],
deps = ["@org_golang_x_tools//go/analysis/passes/buildssa"],
)
```
```go
type A struct{}
func someFunc[T any]() {}
var _ = someFunc[A]
```
### What did you expect to see?
A successful build.
### What did you see instead?
```
(13:13:40) ERROR: /Users/thomas/.a failed: (Exit 1): builder failed: error executing command bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix darwin_arm64 -src .go -embedroot '' ... (remaining 22 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox
compilepkg: panic: unexpected container type in IndexExpr: func[T any]()
goroutine 18 [running]:
golang.org/x/tools/go/ssa.(*builder).expr0(0x1400018f9f0, 0x1400035b6c0, {0x104851e28?, 0x140001902a0?}, {0x7, {0x104851638, 0x140002e3f00}, {0x0, 0x0}})
external/org_golang_x_tools/go/ssa/builder.go:897 +0x2080
golang.org/x/tools/go/ssa.(*builder).expr(0x1048515c0?, 0x1400035b6c0, {0x104851e28?, 0x140001902a0?})
external/org_golang_x_tools/go/ssa/builder.go:610 +0x134
golang.org/x/tools/go/ssa.(*builder).assign(0x104814940?, 0x14000316f60?, {0x104852690?, 0x1049beac0}, {0x104851e28?, 0x140001902a0?}, 0x0?, 0x0)
external/org_golang_x_tools/go/ssa/builder.go:583 +0x320
golang.org/x/tools/go/ssa.(*Package).build(0x140000cd000)
external/org_golang_x_tools/go/ssa/builder.go:2477 +0x9b4
sync.(*Once).doSlow(0x140001d4240?, 0x1400019e000?)
GOROOT/src/sync/once.go:68 +0x10c
sync.(*Once).Do(...)
GOROOT/src/sync/once.go:59
golang.org/x/tools/go/ssa.(*Package).Build(...)
external/org_golang_x_tools/go/ssa/builder.go:2413
golang.org/x/tools/go/analysis/passes/buildssa.run(0x14000302ea0)
external/org_golang_x_tools/go/analysis/passes/buildssa/buildssa.go:73 +0x13c
main.(*action).execOnce(0x140000a0630)
external/io_bazel_rules_go/go/tools/builders/nogo_main.go:301 +0x764
sync.(*Once).doSlow(0x0?, 0x0?)
GOROOT/src/sync/once.go:68 +0x10c
sync.(*Once).Do(...)
GOROOT/src/sync/once.go:59
main.(*action).exec(0x0?)
external/io_bazel_rules_go/go/tools/builders/nogo_main.go:245 +0x44
main.execAll.func1(0x0?)
external/io_bazel_rules_go/go/tools/builders/nogo_main.go:239 +0x50
created by main.execAll
external/io_bazel_rules_go/go/tools/builders/nogo_main.go:237 +0x48
```
Contributor guide
Research direction
Reproduce the panic with the provided nogo configuration and generic-function example. Start at external/org_golang_x_tools/go/ssa/builder.go:897, then inspect the buildssa entry point in external/org_golang_x_tools/go/analysis/passes/buildssa/buildssa.go and the nogo invocation in external/io_bazel_rules_go/go/tools/builders/nogo_main.go. Done means the example builds successfully without the unexpected container type panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100