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

Panic when compiled on go 1.22 #143

Closed
zemanlx opened this issue Feb 8, 2024 · 2 comments · Fixed by #144
Closed

Panic when compiled on go 1.22 #143

zemanlx opened this issue Feb 8, 2024 · 2 comments · Fixed by #144

Comments

@zemanlx
Copy link

zemanlx commented Feb 8, 2024

wsl works well when used with go 1.21

$ docker run -it --rm -v $PWD:/code -w /code golang:1.21 bash -c "go install github.com/bombsimon/wsl/v4/cmd...@master && wsl --fix ."
go: downloading github.com/bombsimon/wsl/v4 v4.2.0
go: downloading golang.org/x/tools v0.6.0
go: downloading golang.org/x/sys v0.5.0
go: downloading golang.org/x/mod v0.8.0

but panic when compiled on go 1.22

$ docker run -it --rm -v $PWD:/code -w /code golang:1.22 bash -c "go install github.com/bombsimon/wsl/v4/cmd...@master && wsl --fix ."
go: downloading github.com/bombsimon/wsl/v4 v4.2.0
go: downloading golang.org/x/tools v0.6.0
go: downloading golang.org/x/sys v0.5.0
go: downloading golang.org/x/mod v0.8.0
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=0x1 addr=0x0 pc=0x59789e]

goroutine 10 [running]:
go/types.(*Checker).handleBailout(0xc000b53600, 0xc002a41bd0)
        /usr/local/go/src/go/types/check.go:367 +0x88
panic({0x720d80?, 0x9ac9c0?})
        /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x7f0c08, 0x9b1120})
        /usr/local/go/src/go/types/sizes.go:228 +0x31e
go/types.(*Config).sizeof(...)
        /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x7f0c08?, 0x9b1120?})
        /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x7f1f60, 0x9a5348}, 0xc000b53600, 0x9b1120, 0xc002a3ddf0)
        /usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc000b53600, 0xc002a1ba40, 0x9b1120)
        /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000b53600, 0xc002a1ba40, {0x7f0c08, 0x9b1120})
        /usr/local/go/src/go/types/expr.go:375 +0x30d
go/types.(*Checker).assignment(0xc000b53600, 0xc002a1ba40, {0x7f0c08, 0x9b1120}, {0xc000530168, 0x13})
        /usr/local/go/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).arguments(0xc000b53600, 0xc0011946c0, 0xc0005e3940, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0xc00118a300, ...}, ...)
        /usr/local/go/src/go/types/call.go:654 +0x13dc
go/types.(*Checker).callExpr(0xc000b53600, 0xc002a1ba00, 0xc0011946c0)
        /usr/local/go/src/go/types/call.go:304 +0x6e9
go/types.(*Checker).exprInternal(0xc000b53600, 0x0, 0xc002a1ba00, {0x7f1b28, 0xc0011946c0}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1374 +0xf8
go/types.(*Checker).rawExpr(0xc000b53600, 0x0, 0xc002a1ba00, {0x7f1b28?, 0xc0011946c0?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).stmt(0xc000b53600, 0x0, {0x7f1258, 0xc0011881e0})
        /usr/local/go/src/go/types/stmt.go:394 +0x12d
go/types.(*Checker).stmtList(0xc000b53600, 0x0, {0xc001c6f4c0?, 0x773847?, 0x5?})
        /usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).stmt(0xc000b53600, 0x0, {0x7f1a08, 0xc00118e480})
        /usr/local/go/src/go/types/stmt.go:562 +0x20f2
go/types.(*Checker).stmt(0xc000b53600, 0x0, {0x7f1138, 0xc001194700})
        /usr/local/go/src/go/types/stmt.go:574 +0x3017
go/types.(*Checker).stmtList(0xc000b53600, 0x0, {0xc001194740?, 0xc002a26fc0?, 0xc002a17948?})
        /usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc000b53600, 0x7f0c08?, {0xc000542274?, 0x9b1300?}, 0xc002a1b0c0, 0xc00118e4b0, {0x0?, 0x0?})
        /usr/local/go/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
        /usr/local/go/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc000b53600, 0x0)
        /usr/local/go/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc000b53600, {0xc00118a008, 0x1, 0x1})
        /usr/local/go/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
        /usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc00018a0e0, 0xc00087cf30)
        /go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:1052 +0xa72
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:851 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
        /usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
        /go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:839 +0x4a
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
        /go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:774 +0x26
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
        /go/pkg/mod/golang.org/x/tools@v0.6.0/go/packages/packages.go:773 +0xccf

I have run it on the master of this repo.

@bombsimon
Copy link
Owner

Thanks for this! Seems like a simple bump of dependencies doing the trick, updated them and it now works with Go 1.22 (also tested Go 1.21 and Go 1.20).

The install instructions and your command mentions master so it should already work but I'll draft a new release so you can do go install github.com/bombsimon/wsl/v4

@bombsimon
Copy link
Owner

Should be released under v4.2.1

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 a pull request may close this issue.

2 participants