Documentation
¶
Overview ¶
Package cache implements a build artifact cache.
Index ¶
- Constants
- Variables
- func DefaultDir() string
- func FileHash(file string) ([HashSize]byte, error)
- func SetFileHash(file string, sum [HashSize]byte)
- type ActionID
- type Cache
- func (c *Cache) Get(id ActionID) (Entry, error)
- func (c *Cache) GetBytes(id ActionID) ([]byte, Entry, error)
- func (c *Cache) GetFile(id ActionID) (file string, entry Entry, err error)
- func (c *Cache) OutputFile(out OutputID) string
- func (c *Cache) Put(id ActionID, file io.ReadSeeker) (OutputID, int64, error)
- func (c *Cache) PutBytes(id ActionID, data []byte) error
- func (c *Cache) PutNoVerify(id ActionID, file io.ReadSeeker) (OutputID, int64, error)
- func (c *Cache) Trim()
- type Entry
- type Hash
- type OutputID
Constants ¶
View Source
const HashSize = 32
HashSize is the number of bytes in a hash.
Variables ¶
View Source
var DebugTest = false
DebugTest is set when GODEBUG=gocachetest=1 is in the environment.
Functions ¶
func DefaultDir ¶
func DefaultDir() string
DefaultDir returns the effective GOCACHE setting. It returns "off" if the cache is disabled.
func FileHash ¶
FileHash returns the hash of the named file. It caches repeated lookups for a given file, and the cache entry for a file can be initialized using SetFileHash. The hash used by FileHash is not the same as the hash used by NewHash.
func SetFileHash ¶
SetFileHash sets the hash returned by FileHash for file.