Skip to content

Commit

Permalink
Exit if curl is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikbratashchuk committed May 13, 2024
1 parent 20f2313 commit 2baa4ce
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions public/install-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
# Multi-platform (Linux and macOS)
# Multi-architecture (amd64, arm64, arm) support

deps=( curl jq )
# if curl is not installed then install it
if ! command -v curl &> /dev/null; then
echo "curl is not installed. Please install curl and try again."
exit 1
fi

for dep in "${deps[@]}"; do
if ! command -v "$dep" &> /dev/null; then
echo "$dep is not installed. Downloading and executing the script..."
curl -sSL https://rollkit.dev/install-jq.sh | bash
fi
done
# if jq is not installed then install it using the script
if ! command -v jq &> /dev/null; then
echo "jq is not installed. Downloading and executing the script..."
curl -sSL https://rollkit.dev/install-jq.sh | bash
fi

version="${1:-$(curl -s 'https://go.dev/dl/?mode=json' | jq -r '.[0].version')}"
current="$(/usr/local/go/bin/go version 2>/dev/null | awk '{print $3}')"
Expand Down

0 comments on commit 2baa4ce

Please sign in to comment.