Help us shape the future of Go! Take the 2026 Go Developer Survey

iso

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package iso synthesizes deterministic ISO9660 volumes on the runner for the data.hyperv_iso_volume data source: same volume_label + files map always produces byte-identical output, so sha256 stays stable across applies and the runner-streamed transport-corruption check never false-positives. kdomanski/iso9660 v0.4.0 otherwise injects non-determinism into the Primary Volume Descriptor at sector 16 (a runtime.GOOS-derived SystemIdentifier and time.Now()-derived timestamps); Build post-processes those PVD fields to fixed values at their known ECMA-119 byte offsets.

Index

Constants

View Source
const MaxVolumeLabelLen = 32

MaxVolumeLabelLen is the ECMA-119 PVD VolumeIdentifier limit (32 d-characters). Longer labels would be silently truncated by kdomanski/iso9660; rejecting at the API boundary surfaces the limit to callers (resource validators, tests) where it can produce a clean diagnostic.

Variables

This section is empty.

Functions

func Build

func Build(volumeLabel string, files []File) ([]byte, error)

Build synthesizes a deterministic ISO9660 volume with the given volume label and file set, returning the raw bytes. volumeLabel must be 1-32 d-characters (A-Z, 0-9, underscore); cloud-init uppercases the PVD label before comparing, so "cidata" and "CIDATA" both match, but the resource layer should normalize case before calling Build. files is sorted by Name first, so the staging-dir traversal order doesn't depend on the caller's slice order. Peak memory is roughly 2x the output size during WriteTo's buffering, fine for the sub-MiB seeds this resource targets.

Types

type File

type File struct {
	Name    string
	Content []byte
}

File is one entry to embed at the root of the synthesized ISO. Name is the filename as it appears on the volume; Content is the raw bytes (UTF-8 for cidata YAMLs, XML for autounattend, arbitrary bytes otherwise). Subdirectories are deliberately not exposed: the canonical NoCloud (cidata) and autounattend layouts both put files at the volume root, and a hierarchical files map would force callers to think about path delimiters and ECMA-119's depth limit for marginal benefit.

Jump to

Keyboard shortcuts

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