file

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPackage marks a structurally invalid package: the built root
	// is not a struct, or load.Instances did not resolve exactly one instance.
	ErrInvalidPackage = shape.ErrInvalidPackage

	// ErrWrongKind marks a package whose concrete kind does not match the
	// artifact the loader was asked for.
	ErrWrongKind = shape.ErrWrongKind

	// ErrMissingRequiredField marks a package missing a required identity
	// field, or carrying it in non-concrete form.
	ErrMissingRequiredField = shape.ErrMissingRequiredField
)

The module shape gate is single-sourced in opm/helper/loader/internal/shape so that loader/file and loader/registry validate artifacts identically. The sentinels are re-exported here with unchanged identity: existing errors.Is(err, file.ErrWrongKind) callers keep working because these are the same error values the shared gate wraps. See shape for the gate itself.

Functions

func LoadModulePackage

func LoadModulePackage(ctx *cue.Context, dirPath string, opts LoadOptions) (cue.Value, error)

LoadModulePackage loads a module CUE package from a directory and returns the raw cue.Value. Used by callers (e.g. opm module vet) to load a module for validation or rendering.

LoadOptions.Registry, when non-empty, is applied via load.Config.Env so the module's transitive imports (transformers, traits, sub-modules) resolve from the override registry without mutating process state.

The recommended entry point is Kernel.LoadModulePackage, which owns its *cue.Context and threads cross-cutting dependencies through every operation. Call this function directly only if you are not using a Kernel.

func LoadPlatformPackage

func LoadPlatformPackage(ctx *cue.Context, dirPath string, opts LoadOptions) (cue.Value, error)

LoadPlatformPackage loads a #Platform CUE package from a directory and returns the raw cue.Value. Mirrors LoadModulePackage and LoadReleasePackage: every .cue file in dirPath that shares the package is unified into a single instance, so the platform is identified by its CUE package clause rather than a platform.cue filename.

LoadOptions.Registry, when non-empty, is applied via load.Config.Env so the platform's transitive imports resolve from the override registry without mutating process state.

The recommended entry point is Kernel.LoadPlatformPackage, which owns its *cue.Context and threads cross-cutting dependencies through every operation. Call this function directly only if you are not using a Kernel.

func LoadReleasePackage

func LoadReleasePackage(ctx *cue.Context, dirPath string, opts LoadOptions) (cue.Value, error)

LoadReleasePackage loads a #ModuleRelease CUE package from a directory and returns the raw cue.Value. Mirrors LoadModulePackage: every .cue file in dirPath that shares the package is unified into a single instance, so authors can split a release across release.cue, values.cue, and overlay files within one CUE package.

LoadOptions.Registry, when non-empty, is applied via load.Config.Env so the release's module imports resolve from the override registry without mutating process state.

The recommended entry point is Kernel.LoadReleasePackage, which owns its *cue.Context and threads cross-cutting dependencies through every operation. Call this function directly only if you are not using a Kernel.

Types

type LoadOptions

type LoadOptions struct {
	// Registry overrides the CUE_REGISTRY value used while loading. Empty
	// means use the current process environment.
	//
	// The override is applied via load.Config.Env, NOT os.Setenv, so the
	// loader is safe to call concurrently from a long-running service
	// (Crossplane function, REST API, embedded SDK).
	Registry string
}

LoadOptions configures package-loader behavior shared by LoadModulePackage, LoadReleasePackage, and LoadPlatformPackage.

Jump to

Keyboard shortcuts

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