This repository was archived by the owner on Aug 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 683
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Crashing with Go 1.22 #400
Copy link
Copy link
Closed
Description
Describe the bug
Does not work with Go 1.22 (both rc1 and rc2, final is scheduled to be released this February 2024).
Found the problem when trying to run wire in Grafana (see grafana/grafana#80514) but the problem is also reproducable in the Go tests in this rpository.
To Reproduce
- Install Go 1.22 rc1 or rc2 (eg using the usual
go install golang.org/dl/go1.22rc2@latest && go1.22rc2 download
or from https://go.dev/dl/) - checkout this repository
- run tests
go1.22rc2 test ./...
- See error:
wire|main ⇒ go1.22rc2 test ./...
? github.com/google/wire [no test files]
? github.com/google/wire/cmd/wire [no test files]
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1042528a0]
goroutine 242 [running]:
go/types.(*Checker).handleBailout(0x140005d2600, 0x1400051fc38)
/Users/xxx/sdk/go1.22rc2/src/go/types/check.go:367 +0x9c
panic({0x10438f260?, 0x10456c4d0?})
/Users/xxx/sdk/go1.22rc2/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x1043dae70, 0x104571080})
/Users/xxx/sdk/go1.22rc2/src/go/types/sizes.go:228 +0x320
go/types.(*Config).sizeof(...)
/Users/xxx/sdk/go1.22rc2/src/go/types/sizes.go:333
go/types.representableConst.func1({0x1043dae70?, 0x104571080?})
/Users/xxx/sdk/go1.22rc2/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x1043dcfb8, 0x104563be0}, 0x140005d2600, 0x104571080, 0x1400051f388)
/Users/xxx/sdk/go1.22rc2/src/go/types/const.go:92 +0x138
go/types.(*Checker).representation(0x140005d2600, 0x1400088c8c0, 0x104571080)
/Users/xxx/sdk/go1.22rc2/src/go/types/const.go:256 +0x68
go/types.(*Checker).implicitTypeAndValue(0x140005d2600, 0x1400088c8c0, {0x1043dae98, 0x14000684150})
/Users/xxx/sdk/go1.22rc2/src/go/types/expr.go:375 +0x340
go/types.(*Checker).assignment(0x140005d2600, 0x1400088c8c0, {0x1043dae98, 0x14000684150}, {0x1042f1589, 0x14})
/Users/xxx/sdk/go1.22rc2/src/go/types/assignments.go:52 +0x23c
go/types.(*Checker).initConst(0x140005d2600, 0x140003a6e40, 0x1400088c8c0)
/Users/xxx/sdk/go1.22rc2/src/go/types/assignments.go:126 +0x304
go/types.(*Checker).constDecl(0x140005d2600, 0x140003a6e40, {0x1043dbe50, 0x140003bac40}, {0x1043dbe50, 0x140003bac60}, 0x0)
/Users/xxx/sdk/go1.22rc2/src/go/types/decl.go:490 +0x298
go/types.(*Checker).objDecl(0x140005d2600, {0x1043df6f8, 0x140003a6e40}, 0x0)
/Users/xxx/sdk/go1.22rc2/src/go/types/decl.go:191 +0x84c
go/types.(*Checker).packageObjects(0x140005d2600)
/Users/xxx/sdk/go1.22rc2/src/go/types/resolver.go:693 +0x468
go/types.(*Checker).checkFiles(0x140005d2600, {0x140000a0108, 0x3, 0x3})
/Users/xxx/sdk/go1.22rc2/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
/Users/xxx/sdk/go1.22rc2/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0x14000330000, 0x140004c2960)
/Users/xxx/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:955 +0x5e8
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
/Users/xxx/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:793 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
/Users/xxx/sdk/go1.22rc2/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
/Users/xxx/sdk/go1.22rc2/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x1?)
/Users/xxx/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:781 +0x50
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
/Users/xxx/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:788 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 225
/Users/xxx/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:787 +0x84
FAIL github.com/google/wire/internal/wire 0.552s
FAIL
Expected behavior
Expected the tests to pass (or to fail the same way as with Go 1.21)
Version
Tests ran on current HEAD
on main
branch: 0675cdc
grafana/grafana#80514 uses latest release 0.5.0
Additional context
Noticed problems when testing
Raised the issue in Grafana:
vvakame, thall, fredrikaverpil and frankravvakame
Metadata
Metadata
Assignees
Labels
No labels