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 with Go 1.23 #1

Merged
merged 3 commits into from
Nov 26, 2024

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

?   	github.com/stbenjam/no-sprintf-host-port/cmd/nosprintfhostport	[no test files]
?   	github.com/stbenjam/no-sprintf-host-port/plugin	[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=0x1008c3054]

goroutine 196 [running]:
go/types.(*Checker).handleBailout(0x14000522540, 0x140004efc58)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:404 +0x9c
panic({0x1009d5ce0?, 0x100bb4530?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x100a23348, 0x100bb7ba0})
	/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({0x100a23348?, 0x100bb7ba0?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:77 +0x90
go/types.representableConst({0x100a24968, 0x100babc48}, 0x14000522540, 0x100bb7ba0, 0x140004ee8b8)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x14000522540, 0x1400054ff40, 0x100bb7ba0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x14000522540, 0x1400054ff40, {0x100a23348, 0x100bb7ba0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:377 +0x304
go/types.(*Checker).convertUntyped(0x14000522540, 0x1400054ff40, {0x100a23348, 0x100bb7ba0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:290 +0x30
go/types.(*Checker).isValidIndex(0x14000522540, 0x1400054ff40, 0x34, {0x10093a958, 0x5}, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/index.go:384 +0x64
go/types.(*Checker).index(0x14000522540, {0x100a23940, 0x14000532120}, 0xffffffffffffffff)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/index.go:355 +0x9c
go/types.(*Checker).indexExpr(0x14000522540, 0x1400054ff00, 0x14000558f00)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/index.go:207 +0x6a0
go/types.(*Checker).exprInternal(0x14000522540, 0x0, 0x1400054ff00, {0x100a23dc0, 0x14000516150}, {0x0, 0x0})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:1365 +0x208c
go/types.(*Checker).rawExpr(0x14000522540, 0x0, 0x1400054ff00, {0x100a23dc0?, 0x14000516150?}, {0x0?, 0x0?}, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:981 +0x120
go/types.(*Checker).expr(0x14000522540, 0x0?, 0x1400054ff00, {0x100a23dc0?, 0x14000516150?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:1549 +0x38
go/types.(*Checker).assignVar(0x14000522540, {0x100a239a0, 0x140005320e0}, {0x100a23dc0, 0x14000516150}, 0x0, {0x10093c107, 0xa})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:272 +0x104
go/types.(*Checker).assignVars(0x14000522540, {0x1400050c0a0?, 0x1, 0x100a23348?}, {0x1400050c0b0, 0x100bb7ea0?, 0x140004ef298?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:472 +0x2c0
go/types.(*Checker).stmt(0x14000522540, 0x0, {0x100a24060, 0x1400053e080})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:483 +0xd04
go/types.(*Checker).stmtList(0x14000522540, 0x0, {0x14000532260?, 0x14000522540?, 0x140004efa58?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x14000522540, 0x100a239a0?, {0x1400050a098?, 0x100a26b78?}, 0x1400054ef80, 0x14000516240, {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(0x14000522540, 0x0)
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:516 +0x12c
go/types.(*Checker).checkFiles(0x14000522540, {0x14000514008, 0x1, 0x1})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:462 +0x1b4
go/types.(*Checker).Files(0x1400019a000?, {0x14000514008?, 0x14000508360?, 0x9?})
	/opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x1400019a000, 0x14000449be0)
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:966 +0x618
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:803 +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:791 +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:798 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 182
	/Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:797 +0x84
FAIL	github.com/stbenjam/no-sprintf-host-port/pkg/analyzer	0.583s
FAIL

Copy link
Owner

@stbenjam stbenjam left a comment

Choose a reason for hiding this comment

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

Thanks for this

.github/workflows/go.yml Outdated Show resolved Hide resolved
@stbenjam stbenjam closed this Nov 26, 2024
@stbenjam stbenjam reopened this Nov 26, 2024
```
printf: non-constant format string in call to (*golang.org/x/tools/go/analysis.Pass).Reportf (govet)
```
@stbenjam stbenjam merged commit ebe9e41 into stbenjam:main Nov 26, 2024
3 checks passed
@stbenjam
Copy link
Owner

v0.2.0 released with the fix

@alexandear alexandear deleted the update-x-tools branch November 26, 2024 15:46
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