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

Fix: Update golang.org/x/tools dependency to support Go v1.22.0 #401

Merged
merged 4 commits into from Feb 7, 2024

Conversation

toddtreece
Copy link
Contributor

@toddtreece toddtreece commented Feb 7, 2024

What

  • Fixes Crashing with Go 1.22 #400 by upgrading golang.org/x/tools
  • gofmt fixes suggested by internal/runtests.sh
  • alldeps updates suggested by internal/runtests.sh

Why

I encountered this error during wire generation when trying to build Grafana with Go v1.22.0:

/home/todd/go/bin/wire-v0.5.0 gen -tags "oss" ./pkg/server
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=0x5805de]

goroutine 1555 [running]:
go/types.(*Checker).handleBailout(0xc004732000, 0xc00760dca8)
        /usr/local/go/src/go/types/check.go:367 +0x88
panic({0x680d60?, 0x88d3a0?})
        /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x7250d8, 0x891800})
        /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({0x7250d8?, 0x891800?})
        /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x726af8, 0x885d78}, 0xc004732000, 0x891800, 0xc00760bdb8)
        /usr/local/go/src/go/types/const.go:106 +0x2c7
go/types.(*Checker).representation(0xc004732000, 0xc004ace2c0, 0x891800)
        /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).representable(0xc004732000, 0xc004ace2c0, 0x891800)
        /usr/local/go/src/go/types/const.go:239 +0x26
go/types.(*Checker).shift(0xc004732000, 0xc004ace1c0, 0xc004ace2c0, {0x725d60, 0xc0073cea20}, 0x14)
        /usr/local/go/src/go/types/expr.go:650 +0x1eb
go/types.(*Checker).binary(0xc004732000, 0xc004ace1c0, {0x725d60, 0xc0073cea20}, {0x726330, 0xc004dec8c0}, {0x726330, 0xc004dec8e0}, 0x14, 0x3803)
        /usr/local/go/src/go/types/expr.go:796 +0x150
go/types.(*Checker).exprInternal(0xc004732000, 0x0, 0xc004ace1c0, {0x725d60, 0xc0073cea20}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc004732000, 0x0, 0xc004ace1c0, {0x725d60?, 0xc0073cea20?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc004732000, 0x0?, 0xc004ace1c0, {0x725d60?, 0xc0073cea20?})
        /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).binary(0xc004732000, 0xc004ace1c0, {0x725d60, 0xc0073cea50}, {0x725d60, 0xc0073cea20}, {0x726330, 0xc004dec900}, 0xd, 0x3807)
        /usr/local/go/src/go/types/expr.go:783 +0xa5
go/types.(*Checker).exprInternal(0xc004732000, 0x0, 0xc004ace1c0, {0x725d60, 0xc0073cea50}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc004732000, 0x0, 0xc004ace1c0, {0x725d60?, 0xc0073cea50?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc004732000, 0xc00738fc80?, 0xc004ace1c0, {0x725d60?, 0xc0073cea50?})
        /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).constDecl(0xc004732000, 0xc00738fd40, {0x0, 0x0}, {0x725d60, 0xc0073cea50}, 0x0)
        /usr/local/go/src/go/types/decl.go:488 +0x328
go/types.(*Checker).objDecl(0xc004732000, {0x729118, 0xc00738fd40}, 0x0)
        /usr/local/go/src/go/types/decl.go:191 +0xa49
go/types.(*Checker).packageObjects(0xc004732000)
        /usr/local/go/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc004732000, {0xc0000943b0, 0x1, 0x1})
        /usr/local/go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
        /usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0000f41e0, 0xc000a3c7c0)
        /home/todd/go/pkg/mod/golang.org/x/tools@v0.0.0-20190422233926-fe54fb35175b/go/packages/packages.go:819 +0x5c5
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /home/todd/go/pkg/mod/golang.org/x/tools@v0.0.0-20190422233926-fe54fb35175b/go/packages/packages.go:677 +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?)
        /home/todd/go/pkg/mod/golang.org/x/tools@v0.0.0-20190422233926-fe54fb35175b/go/packages/packages.go:664 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        /home/todd/go/pkg/mod/golang.org/x/tools@v0.0.0-20190422233926-fe54fb35175b/go/packages/packages.go:671 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 518
        /home/todd/go/pkg/mod/golang.org/x/tools@v0.0.0-20190422233926-fe54fb35175b/go/packages/packages.go:670 +0x94

Copy link

google-cla bot commented Feb 7, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@stefanb
Copy link

stefanb commented Feb 7, 2024

Maintainers, please also tag a release after merging.

@toddtreece
Copy link
Contributor Author

@zombiezen @vangent it looks like this repo might not be monitored closely at this point. sorry for the ping, but could one of you help with a review on this one?

Copy link
Collaborator

@zombiezen zombiezen left a comment

Choose a reason for hiding this comment

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

LGTM

@zombiezen
Copy link
Collaborator

Looks like you'll need to update the GitHub Actions workflows as well.

@toddtreece
Copy link
Contributor Author

@zombiezen thanks for the review. updated the action in c0cebf2

@zombiezen
Copy link
Collaborator

@vangent, would you mind tagging the release once this goes in? Thanks.

@zombiezen zombiezen merged commit e57deea into google:main Feb 7, 2024
6 checks 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.

Crashing with Go 1.22
4 participants