lockfile

package
v1.0.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderComment = `# Generated by Dagger. Pins the images and git refs this workspace uses.
# Any Dagger command may update this file; always commit it with your changes.
# Run ` + "`dagger workspace update`" + ` to refresh the pinned versions.`

HeaderComment is written at the top of every non-empty lockfile. It exists to steer readers (humans and coding agents alike) towards committing lockfile changes instead of discarding them: the lockfile is updated as a side effect of running Dagger, so a diff here rarely looks connected to the change that caused it.

Variables

View Source
var ErrMergeConflict = errors.New("lockfile contains merge conflict markers")

ErrMergeConflict indicates that a lockfile contains unresolved Git conflict markers and must be resolved by the user rather than recovered automatically.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Namespace string
	Operation string
	Inputs    []any
	Value     string
}

Entry is a single lockfile tuple entry.

type Lockfile

type Lockfile struct {
	// contains filtered or unexported fields
}

Lockfile stores lock entries keyed by (namespace, operation, inputs).

func New

func New() *Lockfile

New returns an empty lockfile.

func Parse

func Parse(data []byte) (*Lockfile, error)

Parse decodes lockfile JSON lines.

Lines starting with "#" are comments and are ignored. Non-empty files must otherwise start with a supported version header line.

func (*Lockfile) Entries

func (l *Lockfile) Entries() []Entry

Entries returns a deterministic snapshot of all lock entries.

func (*Lockfile) Get

func (l *Lockfile) Get(namespace, operation string, inputs []any) (string, bool)

Get retrieves the value for (namespace, operation, inputs).

func (*Lockfile) Marshal

func (l *Lockfile) Marshal() ([]byte, error)

Marshal encodes lockfile entries to deterministic JSON lines, preceded by HeaderComment and the version header. Comments present in the parsed input are not preserved.

Empty lockfiles marshal to empty bytes.

func (*Lockfile) Set

func (l *Lockfile) Set(namespace, operation string, inputs []any, value string) error

Set records the value for (namespace, operation, inputs).

type UnsupportedVersionError

type UnsupportedVersionError struct {
	Version   string
	Supported string
}

UnsupportedVersionError reports a syntactically valid lockfile version that this package cannot parse.

func (*UnsupportedVersionError) Error

func (err *UnsupportedVersionError) Error() string

func (*UnsupportedVersionError) IsNewer

func (err *UnsupportedVersionError) IsNewer() bool

IsNewer reports whether the unsupported version is newer than the supported version. Non-integer versions are not considered newer.

Jump to

Keyboard shortcuts

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