Documentation
¶
Overview ¶
Package cachedeps downloads and caches pinned files and archives under the per-user OS cache directory (e.g., ${XDG_CACHE_HOME} on Linux, ~/Library/Caches on macOS), so programs use the same artifact versions across machines.
Every dependency is cached at <cache>/<subdir>/<key>: a single file for `Binary` deps, a directory of extracted contents for `TarGz` and `Zip`. The cache key is "<name>-<version>", or just "<name>" when Version is empty. The `Subpath` field on Dependency picks a single entry inside an extracted archive; when empty, `Ensure` returns the extraction directory itself.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// Subdir is the per-application directory under the OS cache root,
// e.g., "myapp". Required.
Subdir string
// Output receives progress messages ("Downloading...", progress
// bar). If nil, progress output is silent.
Output io.Writer
}
Cache stores binary dependencies under <os-cache>/<Subdir>, where <os-cache> is the per-user OS cache directory returned by os.UserCacheDir() (e.g., ${XDG_CACHE_HOME} on Linux, ~/Library/Caches on macOS).
type Dependency ¶
type Dependency struct {
Name string
Version string
Format Format
URLs map[Platform]string
SHA256 map[Platform]string
Subpath string
}
Dependency describes one cacheable artifact. Name is required. Version is optional and, when set, becomes part of the on-disk cache key so different versions sit side by side. URLs and SHA256 are keyed by the platforms supported. Subpath, optional and ignored when Format is Binary, names a specific entry inside an extracted archive (e.g., "go/bin/go"); when empty, Ensure returns the path to the extraction directory.
func (Dependency) CacheKey ¶
func (d Dependency) CacheKey() string
CacheKey returns the on-disk name for this dependency: "<name>-<version>" when Version is set, or just "<name>" when it is empty.