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

fix: Panic running against Go 1.22 #16

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

justenwalker
Copy link
Contributor

@justenwalker justenwalker commented Mar 11, 2024

What

When running convergen 0.6.3 using Go 1.22, a panic is encountered.
This due to the old version of golang.org/x/tools on which this tool currently depends.

This issue was fixed in the tools library here: golang/go#62167

Fixes #15

How

go get golang.org/x/tools@v0.17.0

Panic

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=0x1025843f4]

goroutine 992 [running]:
go/types.(*Checker).handleBailout(0x14000914200, 0x1400076bc38)
	/usr/local/go/src/go/types/check.go:367 +0x9c
panic({0x1026c0060?, 0x1028b29e0?})
	/usr/local/go/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x1027091d8, 0x1028b5e80})
	/usr/local/go/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
	/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x1027091d8?, 0x1028b5e80?})
	/usr/local/go/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x10270a490, 0x1028ab380}, 0x14000914200, 0x1028b5e80, 0x14000767c28)
	/usr/local/go/src/go/types/const.go:92 +0x138
go/types.(*Checker).representation(0x14000914200, 0x14000762100, 0x1028b5e80)
	/usr/local/go/src/go/types/const.go:256 +0x68
go/types.(*Checker).implicitTypeAndValue(0x14000914200, 0x14000762100, {0x1027091d8, 0x1028b5e80})
	/usr/local/go/src/go/types/expr.go:375 +0x304
go/types.(*Checker).convertUntyped(0x14000914200, 0x14000762100, {0x1027091d8, 0x1028b5e80})
	/usr/local/go/src/go/types/const.go:289 +0x30
go/types.(*Checker).matchTypes(0x14000914200, 0x14000096900, 0x14000762100)
	/usr/local/go/src/go/types/expr.go:926 +0x7c
go/types.(*Checker).binary(0x14000914200, 0x14000096900, {0x1027099f0, 0x14000732d80}, {0x102709fc0, 0x140000960c0}, {0x102709f00, 0x14000092140}, 0x29, 0x3eee5)
	/usr/local/go/src/go/types/expr.go:800 +0x114
go/types.(*Checker).exprInternal(0x14000914200, 0x0, 0x14000096900, {0x1027099f0, 0x14000732d80}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x14000914200, 0x0, 0x14000096900, {0x1027099f0?, 0x14000732d80?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000914200, 0x0?, 0x14000096900, {0x1027099f0?, 0x14000732d80?})
	/usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).binary(0x14000914200, 0x14000096900, {0x1027099f0, 0x14000732de0}, {0x1027099f0, 0x14000732d80}, {0x1027099f0, 0x14000732db0}, 0x22, 0x3eee9)
	/usr/local/go/src/go/types/expr.go:783 +0x70
go/types.(*Checker).exprInternal(0x14000914200, 0x0, 0x14000096900, {0x1027099f0, 0x14000732de0}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x14000914200, 0x0, 0x14000096900, {0x1027099f0?, 0x14000732de0?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000914200, 0x0?, 0x14000096900, {0x1027099f0?, 0x14000732de0?})
	/usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).binary(0x14000914200, 0x14000096900, {0x1027099f0, 0x14000732ed0}, {0x1027099f0, 0x14000732de0}, {0x1027099f0, 0x14000732ea0}, 0x22, 0x3eef7)
	/usr/local/go/src/go/types/expr.go:783 +0x70
go/types.(*Checker).exprInternal(0x14000914200, 0x0, 0x14000096900, {0x1027099f0, 0x14000732ed0}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x14000914200, 0x0, 0x14000096900, {0x1027099f0?, 0x14000732ed0?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000914200, 0x1023d8d70?, 0x14000096900, {0x1027099f0?, 0x14000732ed0?})
	/usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).binary(0x14000914200, 0x14000096900, {0x1027099f0, 0x14000732fc0}, {0x1027099f0, 0x14000732ed0}, {0x1027099f0, 0x14000732f90}, 0x22, 0x3ef44)
	/usr/local/go/src/go/types/expr.go:783 +0x70
go/types.(*Checker).exprInternal(0x14000914200, 0x0, 0x14000096900, {0x1027099f0, 0x14000732fc0}, {0x0, 0x0})
	/usr/local/go/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x14000914200, 0x0, 0x14000096900, {0x1027099f0?, 0x14000732fc0?}, {0x0?, 0x0?}, 0x0)
	/usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000914200, 0x1028b5e60?, 0x14000096900, {0x1027099f0?, 0x14000732fc0?})
	/usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).initVars(0x14000914200, {0x140003000e0, 0x1, 0x1025943bc?}, {0x140002b07b0, 0x102594300?, 0x140006a8d98?}, {0x102709c90, 0x14000092540?})
	/usr/local/go/src/go/types/assignments.go:381 +0x570
go/types.(*Checker).stmt(0x14000914200, 0x0, {0x102709c90, 0x14000092540})
	/usr/local/go/src/go/types/stmt.go:524 +0x1898
go/types.(*Checker).stmtList(0x14000914200, 0x0, {0x140002b07c0?, 0x0?, 0x0?})
	/usr/local/go/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x14000914200, 0x1027091d8?, {0x140002a2704?, 0x1028b5e60?}, 0x14000096740, 0x14000732ff0, {0x0?, 0x0?})
	/usr/local/go/src/go/types/stmt.go:41 +0x21c
go/types.(*Checker).funcDecl.func1()
	/usr/local/go/src/go/types/decl.go:852 +0x44
go/types.(*Checker).processDelayed(0x14000914200, 0x0)
	/usr/local/go/src/go/types/check.go:467 +0x12c
go/types.(*Checker).checkFiles(0x14000914200, {0x14000300000, 0x1, 0x1})
	/usr/local/go/src/go/types/check.go:411 +0x188
go/types.(*Checker).Files(...)
	/usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0x140001941c0, 0x140004c7f60)
	/Users/ME/go/pkg/mod/golang.org/x/tools@v0.1.12/go/packages/packages.go:1001 +0x624
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/ME/go/pkg/mod/golang.org/x/tools@v0.1.12/go/packages/packages.go:838 +0x178
sync.(*Once).doSlow(0x696d5f657261706d?, 0xa2c22732e787370?)
	/usr/local/go/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
	/usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x5f657261706d6f63?, 0x22732e7830393373?)
	/Users/ME/go/pkg/mod/golang.org/x/tools@v0.1.12/go/packages/packages.go:826 +0x50
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x2c22732e3436646d?)
	/Users/ME/go/pkg/mod/golang.org/x/tools@v0.1.12/go/packages/packages.go:833 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 936
	/Users/ME/go/pkg/mod/golang.org/x/tools@v0.1.12/go/packages/packages.go:832 +0x84
exit status 2
convergen.go:8: running "go": exit status 1

@reedom reedom self-requested a review March 11, 2024 13:50
@reedom reedom added the bug Something isn't working label Mar 11, 2024
Copy link
Owner

@reedom reedom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works locally, too.
Thanks a lot!

@reedom reedom merged commit b73c51e into reedom:main Mar 11, 2024
1 of 2 checks passed
@justenwalker justenwalker deleted the upgrade-golang-x-tools branch March 11, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fails to run if installed/built with go-1.22
2 participants