Unified disk-image toolkit (create / convert / resize / inspect)
module github.com/go-diskimages/diskimage · ships cmd/diskimage CLI
Creates, converts, and resizes VM disk images (raw / DMG, plus QCOW2 via the CLI), opens them as a uniform BlockDevice, detects the inner filesystem (ext4, APFS, FAT32, NTFS, exFAT, btrfs, XFS, ZFS), reads/writes ext4 volume labels, and layers LUKS or APFS FileVault decryption. Used to prepare images for Apple Virtualization.framework VMs. Pure Go, cross-platform. GRUB patching and OCI/Tart extraction live in the sibling go-bootloaders/grub and tart-oci packages.
Shared format interfaces (Creator / Detector / RawConverter / Resizer)
module github.com/go-diskimages/interface · zero-dependency
Defines the common interfaces every format package satisfies. Thanks to Go's structural typing, format packages need not import it — only callers that use formats polymorphically do. No dependencies beyond the standard library.
QCOW2 v2 codec (Create / Detect / ToRaw / Resize)
module github.com/go-diskimages/qcow2 · pure Go
Pure-Go QCOW2 v2 reader/writer: create sparse images, detect by magic bytes, convert to raw, and grow the virtual size in place by extending the L1 table. Shrinking is rejected (it could silently discard data). Satisfies the interface module's Format without importing it.
dmg
libformat
Apple UDIF disk-image helpers (detect / pack / unpack)
module github.com/go-diskimages/dmg · no hdiutil / plutil
Pure-Go Apple UDIF (.dmg) helpers — no external macOS tools, works on every platform. Parses the koly trailer and blkx tables (RAW / NOCOPY / FREE / LZFSE / ZLIB runs). Reads UDRW/UDRO/UDZO/UDSP; writes UDRW/UDRO/UDZO/UDSP. ADC (UDCO) and bzip2 (UDBZ) are read-only — write is not supported.
raw
libformat
Unstructured (identity) disk-image codec
module github.com/go-diskimages/raw · pure Go
The trivial identity format: byte-for-byte disk contents, no header or metadata. Create writes a sparse zero-filled file, ToRaw is a straight copy, Detect is the negative/fallback case, and Resize both grows and shrinks. Satisfies the interface module's Format without importing it.
Tart/OCI VM-image puller (registry v2, digest-verified)
module github.com/go-diskimages/tart-oci · pure Go
Pulls Tart VM images stored as OCI artifacts (e.g. ghcr.io/cirruslabs/*), speaking the OCI distribution v2 API. Verifies every blob against its digest, decompresses Apple-LZ4-framed disk layers, and materializes a byte-exact raw disk. No tart, no hdiutil, no darwin-only code.