diff --git a/CloudronStack/output/package-functions.sh b/CloudronStack/output/package-functions.sh index 8753c28..f4b39b7 100644 --- a/CloudronStack/output/package-functions.sh +++ b/CloudronStack/output/package-functions.sh @@ -501,10 +501,15 @@ COPY . . # Try to fix go.mod file if it has invalid syntax RUN if [ -f "go.mod" ]; then \ + # Remove any invalid tool directives that might cause parsing errors sed -i '/^tool /d' go.mod 2>/dev/null || echo "No tool directives to remove"; \ + # Remove any other potentially problematic lines + sed -i '/^replace.*=>.*\.\//d' go.mod 2>/dev/null || echo "No local replace directives to remove"; \ fi +# Try multiple build approaches with better error handling RUN CGO_ENABLED=0 GOOS=linux go build -o $binary_name . 2>/dev/null || \ + CGO_ENABLED=0 GOOS=linux go build -o $binary_name ./... 2>/dev/null || \ CGO_ENABLED=0 GOOS=linux go build -o $binary_name ./cmd/... 2>/dev/null || \ echo "Go build failed, proceeding anyway"