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

Upgrade to go 1.21.9 #3855

Merged
merged 24 commits into from
Apr 19, 2024
Merged

Upgrade to go 1.21.9 #3855

merged 24 commits into from
Apr 19, 2024

Conversation

SEJeff
Copy link
Collaborator

@SEJeff SEJeff commented Mar 25, 2024

This was a fair bit more painful than expected.

Changes

  • Updated quic-go
  • Updated go to 1.21.9
  • Added a script to make future upgrades much easier
  • Updated libp2p-go (thanks @HamphreyR26 for node: upgrade go and libp2p [reopen] #3863)
  • Fixed several log entries that happen after the root context is cancelled, but only in unit tests
  • Updated golangci-lint to the latest version to work better with go 1.21.x (the old version pulled down a binary version built with go 1.20.x which the typecheck linter freaked out about).
  • Fixed the implicit memory aliasing in a for loop caught by the updated version of gosec in golangci-lint 1.57.2

Huge shoutout to @pires and @bruce-riley for some help with this.

@SEJeff SEJeff force-pushed the go-upgrade branch 3 times, most recently from 478b7a4 to 622d1c6 Compare April 2, 2024 18:17
@SEJeff SEJeff changed the title Upgrade to go 1.21.1 Upgrade to go 1.21.8 Apr 2, 2024
@SEJeff SEJeff force-pushed the go-upgrade branch 2 times, most recently from 1bc4d74 to 2eb962d Compare April 3, 2024 04:13
@SEJeff SEJeff changed the title Upgrade to go 1.21.8 Upgrade to go 1.21.9 Apr 16, 2024
@SEJeff SEJeff marked this pull request as ready for review April 16, 2024 21:44
bruce-riley
bruce-riley previously approved these changes Apr 16, 2024
Copy link
Contributor

@bruce-riley bruce-riley 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 doing this!!

bruce-riley
bruce-riley previously approved these changes Apr 17, 2024
evan-gray
evan-gray previously approved these changes Apr 17, 2024
barnjamin
barnjamin previously approved these changes Apr 18, 2024
@evan-gray evan-gray requested a review from bruce-riley April 19, 2024 18:07
SEJeff and others added 24 commits April 19, 2024 14:08
Ran via:

    go get github.com/quic-go/[email protected]
Ran via:

    go get go.mongodb.org/mongo-driver@latest
Ran via:

    go get github.com/libp2p/[email protected]

Refs: #3863
Run via:

    go mod tidy

This updates the go.sum and removes unnecessary indirect references.
Except for wormchain.
This was done with scripts/update-go-version.sh
This was done with scripts/update-go-version.sh
This was done with scripts/update-go-version.sh
This is a little helper to make updating the version of go a bit nicer.
* set the default docker command to "dokcer"
* update the comment for the humongous sed command for dockerfiles
* Upgrade golangci-lint to a version built with go 1.21.x. The older
  version was a binary version built with go 1.20.x and it was failing
  against the newer code built with go 1.21.x
* print the golangci-lint version in each run to see what version of go
  it was built with in case there are incompatibilties during the next
  upgrade
* remove the linter config skipping over pkg/supervisor entirely and
  instead put in an override to ignore the `unused` linter for the
  pkg/supervisor testhelpers bits for unsed test functions necessary
  to satisfy the test interface.
Because 1.52.2 is built with go 1.20.x which has issues with this project
now that it is upgraded to 1.21.8.
Caught by an upgraded golangci-lint with the gosec linter:

    ::medium file=node/pkg/watchers/evm/connectors/batch_poller.go,line=226,col=8::G601: Implicit memory aliasing in for loop. (gosec)
    ::medium file=node/pkg/watchers/evm/connectors/batch_poller.go,line=285,col=8::G601: Implicit memory aliasing in for loop. (gosec)
    ::medium file=node/pkg/watchers/evm/connectors/batch_poller_test.go,line=128,col=37::G601: Implicit memory aliasing in for loop. (gosec)

See also: https://husni.dev/beware-of-implicit-memory-aliasing-in-go-foor-loop/
Automated via:

    scripts/update-go-version.sh 1.21.9
Otherwise things get really sad.
* Standardized on prefacing functions with `function` for consistency
* Added a few more comments to explain how things work
* Automatically increment the go version and toolchain in go.mod
* Standardized on prefacing functions with `function` for consistency
* Make the go image debian version a variable for ease of maintenance
Review feedback from @pires
Required after running go mod edit or it refuses to build.
Running `go mod tidy` removes the toolchain so the build works.
@evan-gray evan-gray merged commit 2712dd3 into main Apr 19, 2024
24 checks passed
@evan-gray evan-gray deleted the go-upgrade branch April 19, 2024 18:43
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.

6 participants