cache

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cache resolves where winkit stores large downloaded artifacts: installer ISOs, driver ISOs and the ESD files they are assembled from.

One resolver is shared by the CLI and the tests so that `winkit fetch` seeds exactly the paths the integration tests later read. When they disagree, fetch appears to succeed while every boot test skips.

Index

Constants

View Source
const (
	// WindowsISOName is the assembled Windows installer, named by
	// language so several can coexist.
	WindowsISOName = "windows-arm64-en-us.iso"

	// VirtIOISOName is the virtio-win driver ISO.
	VirtIOISOName = "virtio-win.iso"
)
View Source
const DirEnv = "WINKIT_CACHE_DIR"

DirEnv overrides the cache location. Set it to keep artifacts on a volume that survives container rebuilds, or to share one download between checkouts.

Variables

This section is empty.

Functions

func Dir

func Dir() string

Dir returns the process-wide cache directory: the DirEnv override when set, else $XDG_CACHE_HOME/winkit, else ~/.cache/winkit — on every platform, macOS included. ~/Library/Caches is the Go convention there, but a cross-platform CLI whose docs and scripts say ~/.cache/winkit should mean the same path everywhere. It does not create the directory. Library callers wanting an explicit location should use Config instead.

func VirtIOISO

func VirtIOISO() string

VirtIOISO returns the path the virtio-win driver ISO is cached at.

func WindowsISO

func WindowsISO() string

WindowsISO returns the path the assembled Windows installer is cached at.

Types

type Config

type Config struct {
	// Dir is the cache directory. Empty means use the shared default.
	Dir string
}

Config lets a caller embedding winkit as a library choose the cache location explicitly, instead of inheriting the process environment.

An embedding application usually has its own idea of where large artifacts belong and cannot set environment variables on behalf of the process, so Dir is the authoritative setting when non-empty and the shared default applies otherwise.

func (Config) Resolve

func (c Config) Resolve() string

Resolve returns the cache directory this config selects.

func (Config) VirtIOISO

func (c Config) VirtIOISO() string

VirtIOISO returns the virtio-win driver ISO path within this config's cache.

func (Config) WindowsISO

func (c Config) WindowsISO() string

WindowsISO returns the Windows installer path within this config's cache.

Jump to

Keyboard shortcuts

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