From a025ca29dde61e85f48414b55229135582995a78 Mon Sep 17 00:00:00 2001 From: Vlad Durnea Date: Sat, 31 Oct 2026 08:58:32 +0200 Subject: [PATCH] fix: download-to-file with retries (a truncated piped stream half-extracts the GOROOT) --- action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 582d5a4..b683b92 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,11 @@ runs: *) echo "better-setup-go: unsupported arch $(uname -m)" >&2; exit 1 ;; esac rm -rf /usr/local/go # a base-image GOROOT under the same path corrupts on overlay - curl -fsSL "https://go.dev/dl/go${v}.linux-${arch}.tar.gz" | tar -xz -C /usr/local + # download-to-file with retries: a piped stream that truncates mid-archive leaves a + # half-extracted GOROOT that fails far away from its cause + curl --retry 3 --retry-delay 2 -fsSL -o /tmp/go.tgz "https://go.dev/dl/go${v}.linux-${arch}.tar.gz" + tar -xzf /tmp/go.tgz -C /usr/local + rm -f /tmp/go.tgz ln -sf /usr/local/go/bin/go /usr/local/bin/go ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt go version