Skip to content

Conversation

@alexandear
Copy link
Contributor

@alexandear alexandear commented Nov 27, 2024

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

Note, that the PR also changes to go 1.18 in go.mod because golang.org/x/tools requires Go 1.18.

Details

?   	github.com/kunwardeep/paralleltest	[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=0x103069784]

goroutine 201 [running]:
go/types.(*Checker).handleBailout(0x14000126000, 0x140000d7bb8)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:404 +0x9c
panic({0x10317e520?, 0x103360610?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x1031cc168, 0x103363ba0})
	/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({0x1031cc168?, 0x103363ba0?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:77 +0x90
go/types.representableConst({0x1031cd8c8, 0x103357d40}, 0x14000126000, 0x103363ba0, 0x140000d69d8)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x14000126000, 0x140003171c0, 0x103363ba0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x14000126000, 0x140003171c0, {0x1031cc168, 0x103363ba0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:377 +0x304
go/types.(*Checker).convertUntyped(0x14000126000, 0x140003171c0, {0x1031cc168, 0x103363ba0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:290 +0x30
go/types.(*Checker).matchTypes(0x14000126000, 0x14000317180, 0x140003171c0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:928 +0x7c
go/types.(*Checker).binary(0x14000126000, 0x14000317180, {0x1031ccde8, 0x140003180f0}, {0x1031cc938, 0x140002fc120}, {0x1031cca58, 0x140002fc140}, 0x28, 0x97b7)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:802 +0x114
go/types.(*Checker).exprInternal(0x14000126000, 0x0, 0x14000317180, {0x1031ccde8, 0x140003180f0}, {0x0, 0x0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:1452 +0x1d4
go/types.(*Checker).rawExpr(0x14000126000, 0x0, 0x14000317180, {0x1031ccde8?, 0x140003180f0?}, {0x0?, 0x0?}, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:981 +0x120
go/types.(*Checker).expr(0x14000126000, 0x1031cbf38?, 0x14000317180, {0x1031ccde8?, 0x140003180f0?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:1549 +0x38
go/types.(*Checker).stmt(0x14000126000, 0x0, {0x1031cd118, 0x140003162c0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:579 +0xa3c
go/types.(*Checker).stmtList(0x14000126000, 0x0, {0x140002fc2a0?, 0x14000126000?, 0x3?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x14000126000, 0x1031cc938?, {0x140003ca048?, 0x1031cfe38?}, 0x14000316ec0, 0x14000318240, {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(0x14000126000, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:516 +0x12c
go/types.(*Checker).checkFiles(0x14000126000, {0x140002cc1b8, 0x1, 0x1})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:462 +0x1b4
go/types.(*Checker).Files(0x14000290000?, {0x140002cc1b8?, 0x140002bc660?, 0x6?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x14000290000, 0x14000075410)
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:1052 +0x858
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:851 +0x178
sync.(*Once).doSlow(0x0?, 0x1?)
	/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/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:839 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:846 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 79
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:845 +0x84
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=0x103069784]

goroutine 156 [running]:
go/types.(*Checker).handleBailout(0x1400039da40, 0x140003c1bb8)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:404 +0x9c
panic({0x10317e520?, 0x103360610?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x1031cc168, 0x103363ba0})
	/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({0x1031cc168?, 0x103363ba0?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:77 +0x90
go/types.representableConst({0x1031cd8c8, 0x103357d40}, 0x1400039da40, 0x103363ba0, 0x140003c1488)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x1400039da40, 0x140001b2f40, 0x103363ba0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x1400039da40, 0x140001b2f40, {0x1031cc1b8, 0x140000d4310})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:377 +0x304
go/types.(*Checker).assignment(0x1400039da40, 0x140001b2f40, {0x1031cc1b8, 0x140000d4310}, {0x1030e5f8d, 0x14})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:70 +0x3ac
go/types.(*Checker).initConst(0x1400039da40, 0x140001b6d80, 0x140001b2f40)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:144 +0x1f8
go/types.(*Checker).constDecl(0x1400039da40, 0x140001b6d80, {0x1031cc938, 0x14000292980}, {0x1031cc938, 0x140002929a0}, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/decl.go:482 +0x23c
go/types.(*Checker).objDecl(0x1400039da40, {0x1031cfd98, 0x140001b6d80}, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/decl.go:185 +0x840
go/types.(*Checker).packageObjects(0x1400039da40)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/resolver.go:714 +0x3f0
go/types.(*Checker).checkFiles(0x1400039da40, {0x140000aa870, 0x3, 0x3})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:459 +0x190
go/types.(*Checker).Files(0x14000290000?, {0x140000aa870?, 0x140001b6420?, 0x6?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x14000290000, 0x14000075320)
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:1052 +0x858
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:851 +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/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:839 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:846 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 38
	/Users/Oleksandr_Redko/src/github.com/kunwardeep/paralleltest/vendor/golang.org/x/tools/go/packages/packages.go:845 +0x84
FAIL	github.com/kunwardeep/paralleltest/pkg/paralleltest	0.869s
FAIL

@kunwardeep
Copy link
Owner

Its been ages since i looked at this. Unsure why the Tests didn't run. I will need to take a look at it

go 1.17
go 1.18

require github.com/golangci/golangci-lint v1.31.0

Choose a reason for hiding this comment

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

Out of PR scope comment

Wow

This one should be upgraded somehow.

Or maybe this pre go tool way is not used?

Go 1.18 is not Go 1.24, so go mod -tool is not available, also golangci-lint installed this way is discouraged.

@alexandear alexandear changed the title Update x/tools to fix panic in tests with Go 1.23 Update x/tools to fix panic in tests with Go 1.24 Mar 18, 2025
@alexandear
Copy link
Contributor Author

Updated to Go 1.24.

Its been ages since i looked at this. Unsure why the Tests didn't run. I will need to take a look at it

Maybe you need to press "Approve Workflow Run".

Because on my end, GitHub says:
image

I checked the actions locally and it passes. See https://github.com/alexandear/paralleltest/pull/2/checks

@kunwardeep kunwardeep merged commit c4a0862 into kunwardeep:main Mar 25, 2025
1 check passed
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.

3 participants