Skip to content

Commit dfee570

Browse files
committed
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.
1 parent b82ed88 commit dfee570

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/release.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ required Go version ($goversion)."
193193
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli
194194
popd
195195

196+
# Clear Go build cache to prevent disk space issues during multi-platform builds.
197+
go clean -cache
198+
196199
# Add the hashes for the individual binaries as well for easy verification
197200
# of a single installed binary.
198201
shasum -a 256 "${dir}/"* >> "manifest-$tag.txt"

0 commit comments

Comments
 (0)