go-tools icon indicating copy to clipboard operation
go-tools copied to clipboard

GOCACHEPROG or otherwise hookable caching support

Open bradfitz opened this issue 8 months ago • 1 comments

Go 1.21 added GOEXPERIMENT=cacheprog to let you set GOCACHEPROG to the name of a tool to run as a child process and implement the cmd/go action/build cache via a JSON API over stdin/stdout. (https://github.com/golang/go/issues/59719)

We (@tailscale) are moving to using this in our CI to share a build cache over multiple machines without the slow tar/untar thing that people typically do on GitHub Actions. So far it's working great.

Except staticcheck has its own on-disk cache (a fork of cmd/go's cache prior to GOCACHEPROG support), so we can't share a cache for staticcheck between runs without backing up & restoring the cache directory, or using NFS/SMB/9P/FUSE to a shared cache server.

@dominikh, would you be amenable to us either adding GOCACHEPROG support to staticcheck (admittedly perhaps premature, considering it's still in GOEXPERMENT status), or at least a hook in the staticcheck code to let us build our own staticcheck binary that implements the hook via HTTP client calls to our cache server?

/cc @maisem

bradfitz avatar Oct 25 '23 02:10 bradfitz