Fix Go version compatibility by explicitly using Go 1.22.2

This commit is contained in:
Andreas Düren 2025-03-14 23:07:06 +01:00
parent cf7865b5d1
commit 1f7de4085d

View File

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