-
Notifications
You must be signed in to change notification settings - Fork 6
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
chore: upgrade to go 1.22 #142
Conversation
6a4390f
to
98f39de
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #142 +/- ##
===========================================
- Coverage 67.81% 49.86% -17.96%
===========================================
Files 125 171 +46
Lines 11451 16818 +5367
===========================================
+ Hits 7766 8386 +620
- Misses 3244 7882 +4638
- Partials 441 550 +109 |
📝 WalkthroughWalkthroughThe pull request includes updates across multiple workflow files and configuration settings to upgrade the Go programming language version from Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (4)
networks/local/ethermintnode/Dockerfile (2)
21-21
: Approve Go version upgrade with optimization suggestion.The upgrade to Go 1.22 is consistent with the PR objectives. However, consider using a more lightweight base image for the final stage to reduce the image size and potential attack surface.
Consider replacing the base image with a more minimal version:
-FROM golang:1.22 as final +FROM golang:1.22-alpine as finalThis change would require adjusting the subsequent
apt-get
command to useapk
for Alpine Linux:-RUN apt-get update +RUN apk update && apk add --no-cache bash
Line range hint
1-35
: Suggest improvements to Dockerfile structure and practices.While the Go version upgrade is the primary focus of this PR, consider the following improvements to enhance the overall Dockerfile:
Update the build stage to use a newer Go version:
-FROM golang:stretch as build-env +FROM golang:1.22 as build-envCombine RUN commands to reduce layers:
-RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y $PACKAGES +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y $PACKAGES && \ + rm -rf /var/lib/apt/lists/*Use specific versions for all base images to enhance reproducibility.
Consider using
COPY --from=build-env /go/src/github.com/zeta-chain/ethermint/build/ethermintd /usr/local/bin/
to place the binary in a standard location.Add a non-root user for running the application:
RUN adduser --disabled-password --gecos "" ethermintuser USER ethermintuserThese changes will improve the Dockerfile's maintainability, security, and efficiency.
nix/default.nix (1)
4-7
: Approve the introduction ofnixpkgsUrl
andnixpkgs
variables with a suggestion.The introduction of
nixpkgsUrl
andnixpkgs
variables is a commendable approach to ensure version consistency for Go. The explanatory comment provides valuable context for future maintenance.To further enhance maintainability, consider extracting the commit hash into a separate variable:
nixpkgsCommit = "e544a67ebac014e7932840e277363b0b46bac751"; nixpkgsUrl = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz";This modification would facilitate easier updates and improve traceability.
.github/workflows/test.yml (1)
Line range hint
122-140
: Review of newupload-cache
job.The addition of the
upload-cache
job is a positive step towards improving workflow efficiency. However, there are a few points to consider:
- The matrix strategy seems unnecessary for a single OS. Consider simplifying by directly specifying
runs-on: macos-latest
.- The purpose of instantiating the integration test environment in this job is not immediately clear. Consider adding a comment to explain the rationale behind this step.
Suggested modifications:
upload-cache: if: github.event_name == 'push' needs: ['integration_tests'] runs-on: macos-latest steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v20 - uses: cachix/cachix-action@v15 with: name: ethermint signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - name: 'Instantiate integration test env for caching' run: nix-store -r "$(nix-instantiate tests/integration_tests/shell.nix)" # Add a comment here explaining why this step is necessary for cachingThese changes will streamline the job configuration while maintaining its functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
📒 Files selected for processing (8)
- .github/workflows/build.yml (1 hunks)
- .github/workflows/goreleaser.yml (2 hunks)
- .github/workflows/lint.yml (1 hunks)
- .github/workflows/test.yml (3 hunks)
- go.mod (1 hunks)
- networks/local/ethermintnode/Dockerfile (1 hunks)
- nix/default.nix (1 hunks)
- nix/go_1_18_overlay.nix (0 hunks)
💤 Files with no reviewable changes (1)
- nix/go_1_18_overlay.nix
🧰 Additional context used
🔇 Additional comments (11)
.github/workflows/goreleaser.yml (2)
18-18
: Go version update is appropriate and aligns with project objectives.The update from Go 1.19 to 1.22 is in line with the pull request's primary objective. This change ensures that the goreleaser job uses the latest Go version, which is crucial for maintaining compatibility and leveraging new language features.
28-28
: Minor formatting improvement: newline added at end of file.The addition of a newline at the end of the file adheres to best practices in file formatting. This change, while subtle, contributes to maintaining a clean and consistent codebase.
.github/workflows/build.yml (1)
22-22
: Approval: Go version update implemented correctly.The modification to update the Go version from 1.19 to 1.22 in the
setup-go
action is correct and aligns with the pull request objective.To ensure consistency across the project, please verify that all workflow files have been updated to use Go 1.22. Execute the following script to check for any inconsistencies:
Additionally, it is advisable to review the
go.mod
file to ensure all dependencies are compatible with Go 1.22. Consider running the following command to update dependencies if necessary:nix/default.nix (1)
8-8
: Approve the declaration ofgo_1_22
variable.The declaration of
go_1_22
is succinct and appropriate. It correctly utilizes the newly importednixpkgs
to access the Go 1.22 package, ensuring consistency with the intended upgrade..github/workflows/lint.yml (1)
19-19
: Approve Go version update and suggest verification.The update to Go 1.22 in the linting workflow is appropriate and aligns with the PR objective. This change ensures consistency between the project's Go version and the linting environment.
To ensure all workflow files are consistently updated, please run the following verification script:
This script will help identify any remaining references to older Go versions in other workflow files, ensuring complete consistency across the CI/CD pipeline.
.github/workflows/test.yml (3)
23-23
: Go version update approved.The modification to use Go version 1.22 is in line with the pull request objectives and ensures consistency across the workflow.
50-50
: Go version update approved.The modification to use Go version 1.22 in the
test-importer
job maintains consistency with the overall upgrade strategy.
71-71
: Go version update approved.The modification to use Go version 1.22 in the
test-rpc
job completes the consistent upgrade across all relevant jobs in the workflow.go.mod (3)
Line range hint
11-51
: Verify compatibility of updated dependenciesThe updates to key dependencies, particularly
cosmos-sdk
,cometbft
, andgrpc
, are significant. While these updates are likely necessary for compatibility with Go 1.22, it's crucial to ensure they don't introduce breaking changes.Please run the following commands to verify dependency compatibility:
#!/bin/bash # Verify dependencies and check for any conflicts go mod tidy go mod verify
Line range hint
246-246
: Clarify the necessity of the go-ethereum forkThe addition of a replacement directive for
go-ethereum
with a ZetaChain-maintained fork is notable. While this may be necessary for specific functionality, it's important to understand the implications.Please provide information on:
- The reasons for using a fork instead of the official repository.
- The specific modifications in this fork compared to the original.
- The strategy for keeping this fork up-to-date with upstream changes.
Additionally, run the following command to check for any potential conflicts:
#!/bin/bash # Check for any conflicts with the go-ethereum replacement go list -m all | grep ethereum
3-3
: Verify compatibility with Go 1.22The upgrade to Go 1.22 is in line with the PR objectives. However, it's crucial to ensure that all code is compatible with this new version.
Please run the following commands to verify compatibility:
#141 will require an upgrade to go 1.22. Let's do it in a separate PR to ensure it's working regardless of go-ethereum version.
node is already on 1.22
golangci-lint failures are unrelated
Summary by CodeRabbit
New Features
upload-cache
, in the testing workflow to enhance build efficiency.Improvements
Chores