locals

package
v1.202.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package locals provides resolution for file-scoped local variables in Atmos stack configurations. Locals enable users to define temporary variables that are available within a single file, similar to Terraform and Terragrunt locals.

Key features: - File-scoped: locals do not inherit across file boundaries - Dependency resolution: locals can reference other locals with topological sorting - Cycle detection: circular dependencies are detected and reported clearly - Multi-scope: locals can be defined at global, component-type, and component levels

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

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

Resolver handles dependency resolution and cycle detection for locals. It uses topological sorting to determine the order in which locals should be resolved.

func NewResolver

func NewResolver(locals map[string]any, filePath string) *Resolver

NewResolver creates a resolver for a set of locals. The filePath is used for error message context.

func (*Resolver) GetDependencies

func (r *Resolver) GetDependencies() map[string][]string

GetDependencies returns the dependency graph for testing/debugging.

func (*Resolver) Resolve

func (r *Resolver) Resolve(parentLocals map[string]any) (map[string]any, error)

Resolve processes all locals in dependency order, returning resolved values. Parent locals (from outer scopes) are available during resolution. Returns error if circular dependency detected or undefined local referenced.

Jump to

Keyboard shortcuts

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