Fix Go version compatibility issues and prevent automatic toolchain downloads

This commit is contained in:
Andreas Düren
2025-03-14 23:35:14 +01:00
parent 6050c4564a
commit aaf0dc0ca3
2 changed files with 24 additions and 8 deletions

View File

@@ -352,8 +352,8 @@ cd "$SERVER_DIR"
# Set Go module cache to a writable location
export GOPATH=/app/data/go
export GO111MODULE=on
# Use auto toolchain to allow downloading required version
export GOTOOLCHAIN=auto
# Use local toolchain to avoid downloading required version
export GOTOOLCHAIN=local
# Override version requirements and force module mode
export GOFLAGS="-mod=mod -modcacherw"
# Create a temporary directory for Go module cache and build in writable area
@@ -434,8 +434,8 @@ elif [ -d "$SERVER_DIR/cmd/museum" ]; then
# Instead of modifying go.mod, set environment variables for compatibility
echo "==> Setting Go environment variables for compatibility"
export GOFLAGS="-mod=mod -modcacherw"
# Use auto toolchain to allow downloading required version
export GOTOOLCHAIN=auto
# Use local toolchain to avoid downloading required version
export GOTOOLCHAIN=local
# For Wasabi specific settings
if [[ "${S3_ENDPOINT}" == *"wasabi"* ]]; then
@@ -514,7 +514,7 @@ else
# Instead of trying to modify go.mod, set environment variables for compatibility
echo "==> Setting Go environment variables for compatibility"
export GOFLAGS="-mod=mod -modcacherw"
export GOTOOLCHAIN=go1.22.2
export GOTOOLCHAIN=local
echo "==> Running main.go with Go"
/usr/local/bin/gosu cloudron:cloudron go run -mod=mod main.go --port 8000 \