Merge commit '08e062efb44cbf8230a1766b15190f25bef8fb99' into debian

This commit is contained in:
2025-12-07 18:10:58 -05:00
3 changed files with 39 additions and 44 deletions
-39
View File
@@ -1,39 +0,0 @@
language: bash
matrix:
include:
- os: linux
dist: focal # 20.04
- os: linux
dist: bionic # 18.04 (EOL @ April 2023)
- os: osx
osx_image: xcode12.5 # 11.3
- os: osx
osx_image: xcode12.2 # 10.15.7
install: true
env: REQVER=1.16.7
addons:
homebrew:
packages:
- fish
update: true
apt:
packages:
- fish
update: true
script: >-
bash tests/install.sh &&
source ~/.bashrc &&
bash tests/validate.sh &&
bash tests/remove.sh
bash tests/install-custom-version.sh &&
source ~/.bashrc &&
bash tests/custom-version-validate.sh &&
bash tests/remove.sh
SHELL=$(which fish) bash tests/install.sh
+5 -2
View File
@@ -6,8 +6,11 @@ Feel free to change the variables on the beginning to match whatever version of
Tested working on: Tested working on:
* :white_check_mark: Ubuntu 16.04 to 20.04 * :white_check_mark: Ubuntu
* :white_check_mark: macOS Sierra (10.12) to Big Sur (11.3) * ⚠️ macOS, generally [^1]
* :white_check_mark: Fedora (Workstation)
[^1]: I no longer have the ability to perform automated testing for free. Testers are welcome!
Supported shells: Supported shells:
* Bash, fish, Zsh * Bash, fish, Zsh
+34 -3
View File
@@ -2,11 +2,30 @@
# shellcheck disable=SC2016 # shellcheck disable=SC2016
set -e set -e
VERSION="1.20.6" FALLBACK_VERSION="1.24.4"
VERSION="$FALLBACK_VERSION"
[ -z "$GOROOT" ] && GOROOT="$HOME/.go" [ -z "$GOROOT" ] && GOROOT="$HOME/.go"
[ -z "$GOPATH" ] && GOPATH="$HOME/go" [ -z "$GOPATH" ] && GOPATH="$HOME/go"
# Function to detect the latest Go version from go.dev
get_latest_version() {
local latest_version=""
if hash wget 2>/dev/null; then
latest_version=$(wget -qO- "https://go.dev/VERSION?m=text" 2>/dev/null | head -n 1 | sed 's/go//')
elif hash curl 2>/dev/null; then
latest_version=$(curl -sL "https://go.dev/VERSION?m=text" 2>/dev/null | head -n 1 | sed 's/go//')
fi
# Validate version format
if [[ "$latest_version" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
echo "$latest_version"
else
echo ""
fi
}
OS="$(uname -s)" OS="$(uname -s)"
ARCH="$(uname -m)" ARCH="$(uname -m)"
@@ -117,6 +136,18 @@ elif [ ! -z "$1" ]; then
exit 1 exit 1
fi fi
# Auto-detect latest version if --version was not specified
if [ "$VERSION" == "$FALLBACK_VERSION" ]; then
echo "Detecting latest Go version..."
DETECTED_VERSION=$(get_latest_version)
if [ -n "$DETECTED_VERSION" ]; then
VERSION="$DETECTED_VERSION"
echo "Latest version detected: $VERSION"
else
echo "Could not detect latest version, using fallback: $VERSION"
fi
fi
if [ -d "$GOROOT" ]; then if [ -d "$GOROOT" ]; then
echo "The Go install directory ($GOROOT) already exists. Exiting." echo "The Go install directory ($GOROOT) already exists. Exiting."
exit 1 exit 1
@@ -127,9 +158,9 @@ TEMP_DIRECTORY=$(mktemp -d)
echo "Downloading $PACKAGE_NAME ..." echo "Downloading $PACKAGE_NAME ..."
if hash wget 2>/dev/null; then if hash wget 2>/dev/null; then
wget https://storage.googleapis.com/golang/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz" wget https://dl.google.com/go/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz"
else else
curl -o "$TEMP_DIRECTORY/go.tar.gz" https://storage.googleapis.com/golang/$PACKAGE_NAME curl -o "$TEMP_DIRECTORY/go.tar.gz" https://dl.google.com/go/$PACKAGE_NAME
fi fi
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then