From dfee57023ce87d3c2dd21ead02285a4bbc41de76 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 20 Oct 2025 15:58:56 +0100 Subject: [PATCH] build: clear Go cache between platform builds in release script In this commit, we add a call to "go clean -cache" after each platform build in the release script to prevent the Go build cache from accumulating unbounded disk space during the sequential 15-platform build process. When building for multiple platforms in sequence with "go build -v", Go creates intermediate build artifacts and caches compiled packages for each target platform. While this caching improves build performance within a single platform build, it causes the cache to grow substantially when building for many platforms sequentially. With 15 different platform/ architecture combinations, each with their own cached artifacts, this accumulation was contributing to the disk space exhaustion. By clearing the build cache after each platform completes, we prevent this unbounded growth while still allowing each individual platform build to benefit from caching during its own compilation. The module cache is preserved (we only clear the build cache), so dependencies don't need to be re-downloaded between platforms. --- scripts/release.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/release.sh b/scripts/release.sh index 3ae8c1ec7..56b7c3cb3 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -193,6 +193,9 @@ required Go version ($goversion)." env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli popd + # Clear Go build cache to prevent disk space issues during multi-platform builds. + go clean -cache + # Add the hashes for the individual binaries as well for easy verification # of a single installed binary. shasum -a 256 "${dir}/"* >> "manifest-$tag.txt"