deps

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package deps caches pinned tool binary dependencies under ~/.cache/unobin so unobin invocations use the same toolchain versions across machines and don't depend on whatever happens to be installed on ${PATH}. Single file `Binary` dependencies live at ~/.cache/unobin/bin/<name>-<version>; `TarGz` and `Zip` archives extract to ~/.cache/unobin/<name>-<version>/.

Index

Constants

This section is empty.

Variables

View Source
var All = []Dependency{Go}

All is the registry every test loops over to confirm coverage for the running platform.

View Source
var Go = Dependency{
	Name:    "go",
	Version: "1.26.2",
	Format:  TarGz,
	URLs: map[Platform]string{
		{"linux", "amd64"}:  "https://go.dev/dl/go1.26.2.linux-amd64.tar.gz",
		{"linux", "arm64"}:  "https://go.dev/dl/go1.26.2.linux-arm64.tar.gz",
		{"darwin", "amd64"}: "https://go.dev/dl/go1.26.2.darwin-amd64.tar.gz",
		{"darwin", "arm64"}: "https://go.dev/dl/go1.26.2.darwin-arm64.tar.gz",
	},
	SHA256: map[Platform]string{
		{"linux", "amd64"}:  "990e6b4bbba816dc3ee129eaeaf4b42f17c2800b88a2166c265ac1a200262282",
		{"linux", "arm64"}:  "c958a1fe1b361391db163a485e21f5f228142d6f8b584f6bef89b26f66dc5b23",
		{"darwin", "amd64"}: "bc3f1500d9968c36d705442d90ba91addf9271665033748b82532682e90a7966",
		{"darwin", "arm64"}: "32af1522bf3e3ff3975864780a429cc0b41d190ec7bf90faa661d6d64566e7af",
	},
	BinaryPath: "go/bin/go",
}

Go is the pinned Go toolchain `unobin compile` invokes when building stack binaries. Bumping the version means updating both the URL and the SHA256 for every supported platform.

Functions

func Ensure

func Ensure(dep Dependency) (string, error)

Ensure returns the filesystem path to the cached executable for dep, downloading and extracting on first use. Subsequent calls hit the cache and skip the download.

Types

type Dependency

type Dependency struct {
	Name       string
	Version    string
	Format     Format
	URLs       map[Platform]string
	SHA256     map[Platform]string
	BinaryPath string
}

Dependency describes one cacheable tool. URLs and SHA256 are keyed by the platforms supported. BinaryPath is the path to the executable inside the extracted archive (e.g., "go/bin/go") and is ignored when Format is Binary.

func (Dependency) CacheKey

func (d Dependency) CacheKey() string

CacheKey returns the on-disk name for this dependency.

type Format

type Format int

Format names how a Dependency is delivered.

const (
	// Binary is a single executable file at the URL.
	Binary Format = iota
	// TarGz is a gzipped tar archive containing the executable.
	TarGz
	// Zip is a zip archive extracted to the install directory.
	Zip
)

type Platform

type Platform struct {
	OS   string
	Arch string
}

Platform identifies a target OS and architecture.

Jump to

Keyboard shortcuts

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