go-tool-cache

module
v0.0.0-...-7bca4ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: BSD-3-Clause

README

go-tool-cache

Do you like Go's built-in build & test caching but wish it weren't purely stored on local disk in the $GOCACHE directory?

Want to share your cache over the network between your various machines, coworkers, and CI runs without all that GitHub actions/caches tarring and untarring?

Go's GOCACHEPROG lets you do that!

This was a demonstration repro for when GOCACHEPROG was still a proposal. Now it just contains some misc examples.

Status

GOCACHEPROG shipped as an experiment in Go 1.21. It became official in Go 1.24.

Using

First, build your cache child process. For example,

$ go install github.com/bradfitz/go-tool-cache/cmd/go-cacher@latest

Then tell Go to use it:

$ GOCACHEPROG=$HOME/go/bin/go-cacher go install std

See some stats:

$ GOCACHEPROG="$HOME/go/bin/go-cacher --verbose" go install std
Defaulting to cache dir /home/bradfitz/.cache/go-cacher ...
cacher: closing; 548 gets (0 hits, 548 misses, 0 errors); 1090 puts (0 errors)

Run it again and watch the hit rate go up:

$ GOCACHEPROG="$HOME/go/bin/go-cacher --verbose" go install std
Defaulting to cache dir /home/bradfitz/.cache/go-cacher ...
cacher: closing; 808 gets (808 hits, 0 misses, 0 errors); 0 puts (0 errors)

Directories

Path Synopsis
Package cacheproc implements the mechanics of talking to cmd/go's GOCACHE protocol so you can write a caching child process at a higher level.
Package cacheproc implements the mechanics of talking to cmd/go's GOCACHE protocol so you can write a caching child process at a higher level.
cmd
go-cacher command
The go-cacher binary is a cacher helper program that cmd/go can use.
The go-cacher binary is a cacher helper program that cmd/go can use.
go-cacher-server command
The go-cacher-server is an HTTP server daemon that go-cacher can hit.
The go-cacher-server is an HTTP server daemon that go-cacher can hit.
gocached command
The gocached command is a small example binary showing how to use the gocached library package.
The gocached command is a small example binary showing how to use the gocached library package.
The gocached package provides an HTTP server daemon that go-cacher can hit.
The gocached package provides an HTTP server daemon that go-cacher can hit.
Package wire contains the JSON types that cmd/go uses to communicate with child processes implementing the cache interface.
Package wire contains the JSON types that cmd/go uses to communicate with child processes implementing the cache interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL