Skip to content
Go build cache

Reuse Go build and test results on the next machine.

Connect the Go build cache to shared storage. Fresh runners and developer machines can reuse results when the Go command's cache rules allow it.

.boringcache.toml
workspace = "my-org/app"

[adapters.go]
tag = "go-cache"
command = ["go", "test", "./..."]
boringcache go

How BoringCache fits your build.

Compilation results

Share build results through GOCACHEPROG.

Eligible test results

Reuse completed tests when Go considers them cacheable.

Your Go commands

Keep the commands that already build and test your project.

Share Go build and test results.

Downloaded module source and compiled build results are different caches. This integration shares build and test results, not merely the packages needed to produce them.

Use GOCACHEPROG to share compiled Go results.

A warm module cache avoids downloading dependencies. It does not supply their compiled results. BoringCache connects Go's GOCACHEPROG interface to shared build and test results, so compatible CI and local builds can reuse them.

Keep your Go build and test commands. Go computes the cache keys and decides whether a result is reusable; BoringCache handles the shared cache connection and reports its reads and misses.

Check build hits and test reuse separately.

Run the same commit with the same Go version and build options on a fresh runner. Check the recorded build-cache hits and total time, including transfers. Test output can show (cached) when Go reuses a successful package test result.

Test reuse requires package-list mode, such as go test ./..., and cacheable flags. Changed inputs or -count=1 can make tests run even when compilation hits the cache.

Go's build and test cache rules →

See cache activity for your Go builds.

Inspect build-cache reads, misses, transfers, and storage for each run.

Explore the workspace →
Hugo · Workspace insights
Cache hits

BoringCache · GitHub runner · 4 vCPU

88.2% of 35,305 lookups over 18 builds

Served from the runner
Under 1 ms per read
Read from cache
9.4 GB

Go benchmark

All Go results →

Build times grouped by runner, with cold and warm builds shown separately.

Hugo

Go

Benchmark →

Static site generator written in Go.

Average restore, build and save · lower is better

GitHub runner

4 vCPU · 16 GB · Ubuntu 24.04 x86-64

BoringCache
41.9 s 18 builds
Depot Cache
91.6 s 18 builds
GHA Cache
41.1 s 18 builds
Same CPU model

Builds of one commit can land on different CPU models. These ratios use only the build pairs where both caches ran on the same model; above 1.00× means BoringCache's total time over those pairs was lower.

Depot Cache vs BoringCache
2.26× · 7 of 18
GHA Cache vs BoringCache
0.97× · 11 of 18
5 CPU models recorded
BoringCache · Build cache
AMD EPYC 7763 (11 builds) · AMD EPYC 9V45 (4 builds) · AMD EPYC 9V74 (2 builds) · Intel Xeon 6973P-C (1 build)
Depot Cache
AMD EPYC 7763 (9 builds) · AMD EPYC 9V45 (4 builds) · AMD EPYC 9V74 (2 builds) · Intel Xeon Platinum 8370C (2 builds) · Intel Xeon 6973P-C (1 build)
GHA Cache · Local cache directory restored and saved by actions/cache
AMD EPYC 7763 (9 builds) · AMD EPYC 9V45 (6 builds) · AMD EPYC 9V74 (1 build) · Intel Xeon Platinum 8370C (1 build) · Intel Xeon 6973P-C (1 build)
Cold and warm builds

Each table is one workflow run with one build per cache. A row marked Different CPU ran on another CPU model than BoringCache at the same level, so part of its time difference can come from the hardware.

One cold and warm build per cache
Cache Cold Warm CPU
BoringCache Build cache 89.2 s 20.0 s Cold: AMD EPYC 9V74 · Warm: Intel Xeon Platinum 8573C
Depot Cache 1 min 52 s 81.7 s Cold: AMD EPYC 9V45 · Warm: Intel Xeon Platinum 8370C Different CPU
GHA Cache Local cache directory restored and saved by actions/cache 88.3 s 6.3 s Cold: AMD EPYC 7763 · Warm: AMD EPYC 9V45 Different CPU
Cache hits

BoringCache · GitHub runner · 4 vCPU

88.2% of 35,305 lookups over 18 builds

Served from the runner
Under 1 ms per read
Read from cache
9.4 GB

Keep shared-cache publication in trusted jobs.

Give consumers restore access and publishers a separate permission. Connect supported CI through OIDC or use scoped credentials.

Connect your CI →

Separate readers and publishers

  • Trusted builds Publish shared cache for the next build Read + publish
  • Pull requests Restore cache without replacing it Read only
  • Local development Use a scoped credential for the workspace Scoped access

Common questions

Does BoringCache replace Go's build cache?
No. It plugs into Go's cache program interface so the go command can ask an external process for cache entries.
How is the build cache different from the module cache?
GOCACHE holds build results; GOMODCACHE holds downloaded module source. GOCACHEPROG shares build and test results, so a warm module download alone does not provide the same reuse.
Why can a Go test still run with a warm cache?
Go decides whether a test result can be reused. Changes to inputs, non-cacheable test flags, or running with -count=1 can require the test to run again.
Read the Go setup guide →

Can I help with your build?

Send me a repo or a workflow and I'll take a look. I've spent more than a year on slow Docker, Cargo and Bazel builds in CI.

Get help with your build

Set up Go caching

Install the CLI. Run onboarding to connect your repository and configure your cache.

30-day trial. No credit card required.

curl -sSL https://install.boringcache.com/install.sh | sh
boringcache onboard
boringcache go