-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: add go version comparison to rollkit install script #525
Conversation
WalkthroughThe 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: 4
🧹 Outside diff range and nitpick comments (3)
public/install.sh (3)
32-42
: Consider enhancing version comparison robustnessThe version comparison function works correctly for standard version formats, but could be more robust against edge cases.
Consider adding input validation:
compare_versions() { + # Validate version string format + if ! [[ $1 =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]] || ! [[ $2 =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then + print_error "Invalid version format. Expected format: X.Y[.Z]" + return 3 + fi if [ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$1" ]; then
50-58
: Enhance Go version extraction robustnessThe Go version extraction could be more robust against malformed go.mod files.
Consider using a more precise grep pattern:
-go_mod_version=$(grep "^go " go.mod | cut -d' ' -f2) +go_mod_version=$(grep -E "^go [0-9]+\.[0-9]+(\.[0-9]+)?$" go.mod | cut -d' ' -f2)
48-48
: Add timeout for git clone operationLong-running git operations could hang indefinitely.
Consider adding a timeout:
-cd rollkit || { print_error "Failed to find the downloaded repository."; exit 1; } +if ! timeout 300 cd rollkit 2>/dev/null; then + print_error "Failed to find the downloaded repository or operation timed out" + exit 1 +fi
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.
lgtm!
Overview
This resolves the underlying issue from #523 where the user's go version was lower than the required version.
The script now explicitly checks the go version in the go.mod of rollkit and compares against the local version.
Example output now
Summary by CodeRabbit
New Features
go.mod
for better version management.Bug Fixes
Documentation