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

Update x/tools to fix panic in tests #19

Merged

Conversation

alexandear
Copy link
Contributor

This PR fixes panic in tests when running with Go 1.23.

golang.org/x/tools requires go 1.18 in go.mod.

Details

❯ go version
go version go1.23.3 darwin/arm64
❯ go test ./...
?   	github.com/gostaticanalysis/forcetypeassert/cmd/forcetypeassert	[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=0x104be46c4]

goroutine 7 [running]:
go/types.(*Checker).handleBailout(0x1400053ac40, 0x140002b7c98)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:404 +0x9c
panic({0x104ce37c0?, 0x104eb0330?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x104d2c6e8, 0x104eb3660})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/sizes.go:229 +0x314
go/types.(*Config).sizeof(...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/sizes.go:334
go/types.representableConst.func1({0x104d2c6e8?, 0x104eb3660?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:77 +0x90
go/types.representableConst({0x104d2dae8, 0x104ea7aa0}, 0x1400053ac40, 0x104eb3660, 0x140002b6ab8)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x1400053ac40, 0x1400051f440, 0x104eb3660)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x1400053ac40, 0x1400051f440, {0x104d2c6e8, 0x104eb3660})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:377 +0x304
go/types.(*Checker).convertUntyped(0x1400053ac40, 0x1400051f440, {0x104d2c6e8, 0x104eb3660})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:290 +0x30
go/types.(*Checker).matchTypes(0x1400053ac40, 0x1400051f400, 0x1400051f440)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:928 +0x7c
go/types.(*Checker).binary(0x1400053ac40, 0x1400051f400, {0x104d2d188, 0x14000528210}, {0x104d2cd08, 0x140005167e0}, {0x104d2cd38, 0x14000516800}, 0x28, 0x3be93)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:802 +0x114
go/types.(*Checker).exprInternal(0x1400053ac40, 0x0, 0x1400051f400, {0x104d2d188, 0x14000528210}, {0x0, 0x0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:1452 +0x1d4
go/types.(*Checker).rawExpr(0x1400053ac40, 0x0, 0x1400051f400, {0x104d2d188?, 0x14000528210?}, {0x0?, 0x0?}, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:981 +0x120
go/types.(*Checker).expr(0x1400053ac40, 0x104d2c350?, 0x1400051f400, {0x104d2d188?, 0x14000528210?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:1549 +0x38
go/types.(*Checker).stmt(0x1400053ac40, 0x0, {0x104d2d308, 0x1400051e6c0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:579 +0xa3c
go/types.(*Checker).stmtList(0x1400053ac40, 0x0, {0x14000516960?, 0x1400053ac40?, 0x140002b7a98?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x1400053ac40, 0x104d2cd08?, {0x1400050e1a8?, 0x104d2ff18?}, 0x1400051f140, 0x140005282a0, {0x0?, 0x0?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:41 +0x218
go/types.(*Checker).funcDecl.func1()
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/decl.go:888 +0x44
go/types.(*Checker).processDelayed(0x1400053ac40, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:516 +0x12c
go/types.(*Checker).checkFiles(0x1400053ac40, {0x14000504040, 0x1, 0x1})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:462 +0x1b4
go/types.(*Checker).Files(0x1400011e780?, {0x14000504040?, 0x14000500300?, 0x4?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x1400011e780, 0x140003c05e0)
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:716 +0x4f0
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:574 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/sync/once.go:67
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:561 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:568 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 57
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:567 +0x84
FAIL	github.com/gostaticanalysis/forcetypeassert	1.044s
FAIL

@tenntenn tenntenn merged commit c7c1ad7 into gostaticanalysis:main Feb 11, 2025
@tenntenn
Copy link
Member

Thank you!

@alexandear alexandear deleted the update-x-tools-fix-tests-panic branch February 11, 2025 09:45
@github-actions github-actions bot mentioned this pull request Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants