Documentation
¶
Overview ¶
Package gocache keeps the Go build cache of the machine's user, which every session's builds share, under a size: the entries used least recently go first, as in Go's own trim, which drops only those unused for five days.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBusy = errors.New("a go build runs")
ErrBusy stops a trim: a Go build began while it ran.
Functions ¶
func Dir ¶
func Dir() string
Dir is the build cache the go command uses: $GOCACHE, else go-build in the user's cache directory; "" when it is off or unknown.
func Trim ¶
Trim removes the least recently used entries until the cache holds at most target bytes, and returns the bytes and entries it removed. It asks busy before it starts and every few hundred removals, and stops with ErrBusy once a build runs. An entry gone already is skipped; the go command takes a missing entry for a miss and builds it again.
Types ¶
type Entry ¶
type Entry struct {
Path string
Size int64
// Used is its modification time, which the go command moves on when it
// uses an entry last touched over an hour before.
Used time.Time
}
Entry is one file of the cache: an action or an output.