Install Go Dependency

This commit is contained in:
2026-02-04 21:34:19 -05:00
parent f280c1573d
commit 5c1d1ff1e4

View File

@@ -100,6 +100,37 @@ apt install -y \
build-essential \ build-essential \
apt-transport-https apt-transport-https
############################################
# Install Go
############################################
log "Installing Go..."
GO_VERSION="1.22.10" # change if you want
GO_TARBALL="go${GO_VERSION}.linux-amd64.tar.gz"
GO_URL="https://go.dev/dl/${GO_TARBALL}"
if ! command -v go >/dev/null || ! go version | grep -q "go${GO_VERSION}"; then
rm -rf /usr/local/go
curl -fL --retry 5 --retry-delay 2 "$GO_URL" -o "/tmp/${GO_TARBALL}"
tar -C /usr/local -xzf "/tmp/${GO_TARBALL}"
rm -f "/tmp/${GO_TARBALL}"
fi
# Make Go available system-wide
cat >/etc/profile.d/go.sh <<'EOF'
export GOROOT=/usr/local/go
export GOPATH=/opt/go
export PATH="$GOROOT/bin:$GOPATH/bin:$PATH"
EOF
chmod 644 /etc/profile.d/go.sh
mkdir -p /opt/go
chmod 777 /opt/go
# Verify
/usr/local/go/bin/go version
############################################ ############################################
# Install Node.js (LTS) # Install Node.js (LTS)
############################################ ############################################