overlay

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UniqueName

func UniqueName(identifier string) string

UniqueName renders an identifier as a filesystem-safe name that is injective: two distinct identifiers can never map to the same file. Flattening path separators alone made example.com/a/b and example.com/a_b collide, which let one package's tests silently execute another package's binary; the hash suffix carries the uniqueness, the readable prefix is for humans.

func WriteFile

func WriteFile(workdir string, replace map[string]string) (string, error)

WriteFile marshals {"Replace": replace} into workdir/overlay.json and returns its path. A key whose on-disk path does not exist injects a brand-new file into the package — the compiler sees a file the source tree never contains.

func WriteUnderBasename

func WriteUnderBasename(workdir, group, original string, content []byte) (string, error)

WriteUnderBasename writes content to workdir/group/<basename(original)>, keeping the original file name because the go command derives build constraints — _linux, _amd64, _test — from the name it is given, not from the path being replaced.

Types

This section is empty.

Jump to

Keyboard shortcuts

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