xdef

module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT

README

xdef

Go Reference

Shared definitions for ctx42 container images: OCI Image Spec label names, their matching container environment variable names, placeholder values for unknown build metadata, and helpers for reading those variables from a process environment slice.

Import

import "github.com/ctx42/xdef/pkg/xdef"

Usage

Read OCI image metadata from a container's environment, falling back to sensible defaults when the variables are absent:

env := os.Environ()

// Returns OCI_IMAGE_CREATED value, or current UTC time in RFC3339Nano
// format (truncated to millisecond precision) if not set.
created := xdef.Created(env)

// Returns OCI_IMAGE_REF_NAME value, or a unique "no-cc-<timestamp>"
// tag if not set.
refName := xdef.ImgRefName(env)

Placeholder constants are provided for unknown build metadata:

labels := map[string]string{
    xdef.LabImgRev:     xdef.PhHash,
    xdef.LabImgVer:     xdef.PhRev,
    xdef.LabImgCreated: xdef.PhTime,
}

License

MIT — see LICENSE.

Directories

Path Synopsis
pkg
xdef
Package xdef provides shared definitions for ctx42 container images: OCI Image Spec label names, their matching container environment variable names, placeholder values for unknown build metadata, and helpers for reading those variables from a process environment slice.
Package xdef provides shared definitions for ctx42 container images: OCI Image Spec label names, their matching container environment variable names, placeholder values for unknown build metadata, and helpers for reading those variables from a process environment slice.

Jump to

Keyboard shortcuts

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