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 dependencies for Go 1.22 #32

Merged
merged 1 commit into from Mar 17, 2024

Conversation

nikoremi97
Copy link
Contributor

What: update go.mod go version to 1.22
update golang.org/x/tools to v0.19.0
Why: the old version panicked for go 1.22

update golang.org/x/tools to v0.19.0
Why: the old version panicked for go 1.22
@nikoremi97
Copy link
Contributor Author

Not using the latest version of tools and using Go 1.22 causes the following error:

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

goroutine 25 [running]:
go/types.(*Checker).handleBailout(0x14000356000, 0x1400056bb98)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:367 +0x9c
panic({0x10262b360?, 0x10282fe00?})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x102680b90, 0x102833800})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0x102680b90?, 0x102833800?})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x102681ff8, 0x102828638}, 0x14000356000, 0x102833800, 0x1400056a818)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/const.go:92 +0x138
go/types.(*Checker).representation(0x14000356000, 0x14000478d80, 0x102833800)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/const.go:256 +0x68
go/types.(*Checker).implicitTypeAndValue(0x14000356000, 0x14000478d80, {0x102680b90, 0x102833800})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/expr.go:375 +0x304
go/types.(*Checker).assignment(0x14000356000, 0x14000478d80, {0x102680b90, 0x102833800}, {0x10257b822, 0xa})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/assignments.go:52 +0x23c
go/types.(*Checker).assignVar(0x14000356000, {0x1026810a0, 0x1400041bba0}, {0x102681a00, 0x1400041bbc0}, 0x0, {0x10257b822, 0xa})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/assignments.go:260 +0x18c
go/types.(*Checker).assignVars(0x14000356000, {0x14000091ee0?, 0x1, 0x0?}, {0x14000091ef0, 0x10249b4c0?, 0x1?})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/assignments.go:455 +0x2c4
go/types.(*Checker).stmt(0x14000356000, 0x0, {0x102681760, 0x14000478040})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/stmt.go:476 +0x10f8
go/types.(*Checker).stmtList(0x14000356000, 0x0, {0x14000478080?, 0x0?, 0x2?})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x14000356000, 0x102680b90?, {0x14000437b80?, 0x102833800?}, 0x140005b56c0, 0x14000464420, {0x0?, 0x0?})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/stmt.go:41 +0x21c
go/types.(*Checker).funcDecl.func1()
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/decl.go:852 +0x44
go/types.(*Checker).processDelayed(0x14000356000, 0x0)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:467 +0x12c
go/types.(*Checker).checkFiles(0x14000356000, {0x140005ad2f0, 0x3, 0x3})
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:411 +0x188
go/types.(*Checker).Files(...)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0x14000182000, 0x14000099110)
        /Users/nicolasrecalde/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:1052 +0x870
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /Users/nicolasrecalde/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:851 +0x178
sync.(*Once).doSlow(0x1022dd2e0?, 0x140000947e0?)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
        /opt/homebrew/Cellar/go/1.22.1/libexec/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x102349b04?)
        /Users/nicolasrecalde/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:839 +0x50
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
        /Users/nicolasrecalde/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:774 +0x30
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
        /Users/nicolasrecalde/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:773 +0xaa4
exit status 2

After the go.mod update it runs as expected

@alexkohler alexkohler merged commit ef610e9 into alexkohler:master Mar 17, 2024
1 check passed
@alexkohler
Copy link
Owner

Thank you! Apologies for the delay here.

@alexkohler alexkohler mentioned this pull request Mar 17, 2024
@MarcelH-Tabeo
Copy link

Still a stacktrace:

go install github.com/alexkohler/nakedret/cmd/nakedret@latest
nakedret ./...                                               
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=0x10094db04]

goroutine 86 [running]:
go/types.(*Checker).handleBailout(0x1400032a200, 0x1400024fb98)
        /usr/local/go/src/go/types/check.go:367 +0x9c
panic({0x100b23300?, 0x100d23c20?})
        /usr/local/go/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x100b78b68, 0x100d27840})
        /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({0x100b78b68?, 0x100d27840?})
        /usr/local/go/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x100b79e70, 0x100d1c660}, 0x1400032a200, 0x100d27840, 0x1400024cf08)
        /usr/local/go/src/go/types/const.go:92 +0x138
go/types.(*Checker).representation(0x1400032a200, 0x140011cb8c0, 0x100d27840)
        /usr/local/go/src/go/types/const.go:256 +0x68
go/types.(*Checker).implicitTypeAndValue(0x1400032a200, 0x140011cb8c0, {0x100b78b68, 0x100d27840})
        /usr/local/go/src/go/types/expr.go:375 +0x304
go/types.(*Checker).convertUntyped(0x1400032a200, 0x140011cb8c0, {0x100b78b68, 0x100d27840})
        /usr/local/go/src/go/types/const.go:289 +0x30
go/types.(*Checker).isValidIndex(0x1400032a200, 0x140011cb8c0, 0x34, {0x100a72027, 0x5}, 0x0)
        /usr/local/go/src/go/types/index.go:384 +0x6c
go/types.(*Checker).index(0x1400032a200, {0x100b79a00, 0x14001408960}, 0xffffffffffffffff)
        /usr/local/go/src/go/types/index.go:355 +0x9c
go/types.(*Checker).indexExpr(0x1400032a200, 0x140011cb840, 0x14001572588)
        /usr/local/go/src/go/types/index.go:207 +0x720
go/types.(*Checker).exprInternal(0x1400032a200, 0x0, 0x140011cb840, {0x100b79460, 0x140014045d0}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1329 +0x26f4
go/types.(*Checker).rawExpr(0x1400032a200, 0x0, 0x140011cb840, {0x100b79460?, 0x140014045d0?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x1400032a200, 0x1400140be40?, 0x140011cb840, {0x100b79460?, 0x140014045d0?})
        /usr/local/go/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).exprInternal(0x1400032a200, 0x0, 0x140011cb840, {0x100b79550, 0x14001404630}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1346 +0x5b0
go/types.(*Checker).rawExpr(0x1400032a200, 0x0, 0x140011cb840, {0x100b79550?, 0x14001404630?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).multiExpr(0x1400032a200, {0x100b79550, 0x14001404630}, 0x1)
        /usr/local/go/src/go/types/expr.go:1532 +0x60
go/types.(*Checker).initVars(0x1400032a200, {0x14001166fe0, 0x2, 0x2}, {0x140014001f0, 0x1, 0x1}, {0x0, 0x0})
        /usr/local/go/src/go/types/assignments.go:408 +0x104
go/types.(*Checker).shortVarDecl(0x1400032a200, {0x100b77258, 0x1400017e078}, {0x14001408920, 0x2, 0x0?}, {0x140014001f0, 0x1, 0x1})
        /usr/local/go/src/go/types/assignments.go:556 +0x6f4
go/types.(*Checker).stmt(0x1400032a200, 0x0, {0x100b79760, 0x1400140a740})
        /usr/local/go/src/go/types/stmt.go:473 +0x10d4
go/types.(*Checker).stmtList(0x1400032a200, 0x0, {0x14000600080?, 0x100d27a20?, 0x140013719f8?})
        /usr/local/go/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x1400032a200, 0x100b78bb8?, {0x140003a6030?, 0x140000d81c0?}, 0x14000f56180, 0x140014046c0, {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(0x1400032a200, 0x0)
        /usr/local/go/src/go/types/check.go:467 +0x12c
go/types.(*Checker).checkFiles(0x1400032a200, {0x14001408000, 0x4, 0x4})
        /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(0x1400010a000, 0x1400060b410)
        /Users/Marcello/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:1052 +0x870
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /Users/Marcello/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:851 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
        /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(0x0?, 0x0?)
        /Users/Marcello/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:839 +0x50
golang.org/x/tools/go/packages.(*loader).refine.func2(0x0?)
        /Users/Marcello/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:774 +0x30
created by golang.org/x/tools/go/packages.(*loader).refine in goroutine 1
        /Users/Marcello/go/pkg/mod/golang.org/x/tools@v0.8.0/go/packages/packages.go:773 +0xaa4

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.

None yet

6 participants