From f8b21d771bdbd20af503cc06a154589b040c5f94 Mon Sep 17 00:00:00 2001 From: Pulse Monitor Date: Thu, 11 Sep 2025 16:31:17 +0000 Subject: [PATCH] fix: inline Go installation code to fix undefined install_go function The --main flag was calling install_go which didn't exist. Now properly installs Go 1.23 when needed during source builds. --- install.sh | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 5529f65e2..a0fe11fa6 100755 --- a/install.sh +++ b/install.sh @@ -1729,19 +1729,46 @@ main() { fi # Check for Go installation + GO_INSTALLED=false if ! command -v go &> /dev/null; then print_info "Go is not installed. Installing Go 1.23..." - install_go else GO_VERSION=$(go version | grep -oP 'go\K[0-9]+\.[0-9]+') if awk "BEGIN {exit !($GO_VERSION < 1.23)}"; then print_info "Go version $GO_VERSION is too old. Installing Go 1.23..." - install_go else print_info "Go version $GO_VERSION is installed" + GO_INSTALLED=true fi fi + if [[ "$GO_INSTALLED" != "true" ]]; then + # Detect architecture for Go download + ARCH=$(uname -m) + case $ARCH in + x86_64) + GO_ARCH="amd64" + ;; + aarch64) + GO_ARCH="arm64" + ;; + armv7l) + GO_ARCH="armv7" + ;; + *) + print_error "Unsupported architecture: $ARCH" + exit 1 + ;; + esac + + cd /tmp + wget -q "https://go.dev/dl/go1.23.4.linux-${GO_ARCH}.tar.gz" + rm -rf /usr/local/go + tar -C /usr/local -xzf "go1.23.4.linux-${GO_ARCH}.tar.gz" + export PATH=/usr/local/go/bin:$PATH + rm "go1.23.4.linux-${GO_ARCH}.tar.gz" + fi + # Clone and build print_info "Cloning repository..." TEMP_BUILD_DIR=$(mktemp -d)