Skip to content

fix: add downloading dependencies to install script #524

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ fi

cd rollkit || { echo "Failed to find the downloaded repository."; exit 1; }
git fetch && git checkout $1
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Validate version parameter before checkout

The script uses $1 without validation, which could lead to checkout failures or unexpected versions.

Add version validation:

+if [ -z "$1" ]; then
+    echo "Error: Version parameter is required (e.g., v0.1.0)"
+    exit 1
+fi
+
+# Validate if the version exists
+if ! git ls-remote --tags origin | grep -q "refs/tags/$1$"; then
+    echo "Error: Version $1 not found"
+    exit 1
+fi
+
 git fetch && git checkout $1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
git fetch && git checkout $1
if [ -z "$1" ]; then
echo "Error: Version parameter is required (e.g., v0.1.0)"
exit 1
fi
# Validate if the version exists
if ! git ls-remote --tags origin | grep -q "refs/tags/$1$"; then
echo "Error: Version $1 not found"
exit 1
fi
git fetch && git checkout $1

echo "Installing dependencies..."
go mod tidy
go mod download
Comment on lines +13 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add error handling for dependency management steps

While adding dependency management is crucial for fixing the binary issues, these steps need proper error handling to prevent silent failures.

Consider this improvement:

 echo "Installing dependencies..."
-go mod tidy
-go mod download
+go mod tidy || { echo "Failed to tidy Go modules. Please check your Go environment."; exit 1; }
+go mod download || { echo "Failed to download dependencies. Please check your network connection."; exit 1; }
+echo "Dependencies installed successfully."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "Installing dependencies..."
go mod tidy
go mod download
echo "Installing dependencies..."
go mod tidy || { echo "Failed to tidy Go modules. Please check your Go environment."; exit 1; }
go mod download || { echo "Failed to download dependencies. Please check your network connection."; exit 1; }
echo "Dependencies installed successfully."

echo "Building and installing Rollkit..."
make install
cd ..
Expand Down
Loading