toolchain

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashZip

func HashZip(zipfile string, hash dirhash.Hash, fix HashFixer) (string, error)

HashZip returns the sumdb dirhash of the file content in the named zip file. Only the file names and their contents are included in the hash: the exact zip file format encoding, compression method, per-file modification times, and other metadata are ignored. If fix is non-nil, it is applied to the file contents before hashing it, allowing you to strip code signatures that cannot be reproduced.

func StripDarwinSig

func StripDarwinSig(name string, data []byte) ([]byte, error)

StripDarwinSig parses data as a Mach-O executable, strips the macOS code signature from it, and returns the resulting Mach-O executable. It edits data directly, in addition to returning a shortened version. If data is not a Mach-O executable, StripDarwinSig silently returns it unaltered.

Types

type HashFixer

type HashFixer = func(string, []byte) ([]byte, error)

A HashFixer is a transformation on file content applied during hashing. It lets us edit away permissible differences between files, such as code signatures that cannot be reproduced without the signing keys.

func HashFixerFor

func HashFixerFor(v Version) HashFixer

type Version

type Version struct {
	GoVersion string // e.g. "go1.21.0"
	GOOS      string
	GOARCH    string
}

Version uniquely identifies a built toolchain

func ParseModVersion

func ParseModVersion(modversion string) (Version, bool)

ParseModVersion parses a golang.org/toolchain module version

func (Version) ModVersion

func (v Version) ModVersion() string

ModVersion returns the corresponding golang.org/toolchain module version

func (Version) ZipFilename

func (v Version) ZipFilename() string

ZipFilename returns the filename of the golang.org/toolchain module version

Jump to

Keyboard shortcuts

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