binmgr

package
v0.0.0-...-1d1a5ee Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package binmgr downloads and caches external binaries (cloudflared, javy), keyed by name+version under the user cache dir.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ensure

func Ensure(ctx context.Context, spec Spec) (string, *output.ExitError)

Ensure returns the path to the binary, downloading+caching it under the user cache dir if not already present. Safe to call repeatedly.

Types

type Spec

type Spec struct {
	Name        string
	Version     string
	Compression string // "" = raw binary; "gzip" = gunzip after download; "tgz" = extract tar.gz entry named Name
	URL         func(goos, goarch string) (string, error)
	// SHA256 returns the lowercase-hex SHA-256 of the served artifact (before
	// decompression) for the target platform. When non-nil, the download is
	// verified before being cached; a missing/empty checksum is a hard error
	// (fail-closed). A nil func disables verification (test-only).
	SHA256 func(goos, goarch string) (string, error)
	// Progress, when non-nil, reports the download step on a cache miss. nil disables reporting.
	Progress *output.Progress
}

Spec describes one external binary: how to resolve its per-platform download URL and pinned integrity checksum.

Jump to

Keyboard shortcuts

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