Apps

Go Build Cache

Go stores compiled package archives, test result cache entries, and intermediate build artifacts in its build cache so repeated builds can reuse previous compiler outputs instead of recompiling everything from source. That cache lives on disk under go-build and is keyed from source content, compiler flags, environment, and toolchain details, but old entries can accumulate across branch switches, dependency churn, and Go upgrades. Kudu removes the cached .a package files, cached test outputs, and temporary compiler artifacts so the next build starts from a clean cache without touching your source code, modules, settings, or credentials.

Why it matters

Why clean Go Build Cache?

  • A large go-build directory from many branches and dependency versions wastes gigabytes of disk space, which shows up as low free space even though your project folders are small
  • Invalid cache entries after a Go toolchain upgrade can force a slower first rebuild while everything is recompiled, but clearing old artifacts avoids rechecking and carrying around obsolete compiler outputs
  • Corrupted cached package archives can surface as unexplained build failures or internal compiler errors that disappear after the cache is rebuilt from source
  • Switching between branches with build tags, CGO settings, or different GOOS and GOARCH targets leaves behind many one-off cache entries, making the cache grow rapidly and causing confusingly inconsistent incremental build times
  • Stale cached test results can make go test appear to skip work and instantly report old passing results, which is frustrating when you expect a changed environment or external dependency to be exercised again
  • On shared or long-lived development machines, thousands of small cached objects increase filesystem overhead and can make cache lookups and antivirus scans noticeably slower during builds
  • SQLite-style page fragmentation does not apply here because the Go build cache is a file-based artifact store rather than a database, so cleaning removes obsolete objects directly instead of rewriting pages with VACUUM
What gets cleaned

Cache paths Kudu targets

Windows

%LocalAppData%/go-build

macOS

~/Library/Caches/go-build

Linux

~/.cache/go-build
Frequently asked

Common questions about Go Build Cache

Free & open source

Download Kudu and reclaim your disk space.

Available on Windows, macOS, and Linux. No account required, no feature gates, no telemetry without consent. All cleaning targets are open source and community-auditable.