@@ 66,12 66,14 @@ install_version() {
FILENAME=go$target.$GOOS-$GOARCH.tar.gz
DL_PATH=$LIB_DIR/../$FILENAME
mkdir -p "$LIB_DIR"
- if ! curl -L -o "$DL_PATH" "https://go.dev/dl/$FILENAME"; then
+ echo "Downloading $target"
+ if ! curl -s -L -o "$DL_PATH" "https://go.dev/dl/$FILENAME"; then
echo "Couldn't download Go $target. Are you sure it exists?"
rm "$DL_PATH"
rm -rf "$LIB_DIR"
return 1
fi
+ echo "Extracting $target"
if ! tar --strip-components=1 -xzC "$LIB_DIR" -f "$DL_PATH"; then
echo "Couldn't uncompress Go $target."
rm "$DL_PATH"
@@ 91,7 93,7 @@ activate_version() {
# latest_version emits the latest version of go on stdout
latest_version() {
- versions=$(curl -q https://api.github.com/repos/golang/go/git/refs/tags | grep -e "\"ref\":" | grep -e "go" | grep -v -e "beta" -e "rc" | sed -E 's/.*go([[:digit:]]+(.[[:digit:]]+){0,2}).*/\1/')
+ versions=$(curl -s -q https://api.github.com/repos/golang/go/git/refs/tags | grep -e "\"ref\":" | grep -e "go" | grep -v -e "beta" -e "rc" | sed -E 's/.*go([[:digit:]]+(.[[:digit:]]+){0,2}).*/\1/')
highest_major=0
highest_minor=0
highest_patch=0
@@ 123,7 125,10 @@ latest_version() {
gover() {
target="$1"
- if [ "$target" = "latest" ]; then target=$(latest_version); fi
+ if [ "$target" = "latest" ]; then
+ echo "Looking up latest version..."
+ target=$(latest_version)
+ fi
if [ "$target" = "-h" ] || [ "$target" = "--help" ]; then
printf "Usage: gover [version|latest]\n\nExamples:\n\tgover 1.15\n\tgover 1.7.1\n\tgover latest\n\tgover\n"
return 1