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 #43

Merged
merged 2 commits into from
Dec 2, 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

❯ go version
go version go1.23.3 darwin/arm64
❯ go test ./...
?       github.com/sanposhiho/wastedassign/v2/cmd/wastedassign  [no test files]
?       github.com/sanposhiho/wastedassign/v2/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=0x104dcbc84]

goroutine 65 [running]:
go/types.(*Checker).handleBailout(0x14000237180, 0x1400014fc58)
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:404 +0x9c
panic({0x104f327e0?, 0x1051546c0?})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x104f8bff0, 0x105158180})
        /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({0x104f8bff0?, 0x105158180?})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:77 +0x90
go/types.representableConst({0x104f8d938, 0x10514bdc0}, 0x14000237180, 0x105158180, 0x1400014eee8)
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x14000237180, 0x14000592040, 0x105158180)
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x14000237180, 0x14000592040, {0x104f8bff0, 0x105158180})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/expr.go:377 +0x304
go/types.(*Checker).assignment(0x14000237180, 0x14000592040, {0x104f8bff0, 0x105158180}, {0x104e88937, 0x10})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:70 +0x3ac
go/types.(*Checker).initVar(0x14000237180, 0x14000095740, 0x14000592040, {0x104e88937, 0x10})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:181 +0x3d0
go/types.(*Checker).initVars(0x14000237180, {0x1400009e7d8, 0x1, 0x3?}, {0x14000113860, 0x104f658a0?, 0x1400014f298?}, {0x104f8d008, 0x14000151220?})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/assignments.go:399 +0x584
go/types.(*Checker).stmt(0x14000237180, 0x0, {0x104f8d008, 0x14000151220})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:533 +0x130c
go/types.(*Checker).stmtList(0x14000237180, 0x0, {0x14000113870?, 0x0?, 0x0?})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x14000237180, 0x104f8c978?, {0x14000110c74?, 0x7?}, 0x140004b18c0, 0x14000254090, {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(0x14000237180, 0x0)
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:516 +0x12c
go/types.(*Checker).checkFiles(0x14000237180, {0x1400039c020, 0x2, 0x2})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:462 +0x1b4
go/types.(*Checker).Files(0x14000220000?, {0x1400039c020?, 0x1400039a1e0?, 0x4?})
        /opt/homebrew/Cellar/go/1.23.3/libexec/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x14000220000, 0x14000486560)
        /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:955 +0x5dc
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:793 +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/tools@v0.1.0/go/packages/packages.go:781 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        /Users/Oleksandr_Redko/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 25
        /Users/Oleksandr_Redko/go/pkg/mod/golang.org/x/tools@v0.1.0/go/packages/packages.go:787 +0x84
FAIL    github.com/sanposhiho/wastedassign/v2   0.527s
FAIL

Copy link
Owner

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

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

@alexandear alexandear force-pushed the update-x-tools branch 2 times, most recently from 03f1e08 to 39dadf4 Compare December 1, 2024 13:43
@alexandear
Copy link
Contributor Author

Can you also update go version at: master/.github/workflows/test_and_lint.yaml#L16

Updated Go and golangci-lint version.

@sanposhiho sanposhiho merged commit 28f0c07 into sanposhiho:master Dec 2, 2024
2 checks passed
@alexandear alexandear deleted the update-x-tools branch December 2, 2024 08:02
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