Help us shape the future of Go! Take the 2026 Go Developer Survey

yamlsource

package
v1.234.0-nightly.40981... Latest Latest
Warning

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

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

Documentation

Overview

Package yamlsource preserves explicit YAML function identity across the string-valued fields and serialization boundaries in the configuration pipeline. It has no dependency on configuration or evaluators.

Index

Constants

View Source
const BehaviorKey = "yaml_functions.explicit_tags"

BehaviorKey identifies the edition transition for automatic YAML function evaluation.

Variables

This section is empty.

Functions

func Contains

func Contains(value string) bool

Contains reports whether text includes loader-preserved source, including expressions interpolated into a larger string without evaluation.

func ContainsTag

func ContainsTag(value, tag string) bool

ContainsTag reports whether text embeds source for a tag, as can happen when a template interpolates a computed value into a stack name.

func Display

func Display(value any) any

Display returns an ordinary representation for output formats without YAML tags. Internal JSON cloning should retain the transport strings instead.

func Expression

func Expression(value string) string

Expression unwraps a transported value for an explicit evaluator.

func RestoreTags

func RestoreTags(node *yaml.Node)

RestoreTags restores explicit tags for public YAML output and YAML template passes. Plain strings, including quoted function expressions, are unchanged.

Types

type Source

type Source struct {
	Tag      string `json:"tag"`
	Argument string `json:"-"`
	File     string `json:"file,omitempty"`
	Line     int    `json:"line,omitempty"`
	Column   int    `json:"column,omitempty"`
}

Source identifies an explicit tag and its original scalar argument.

func Decode

func Decode(value string) (Source, bool)

Decode recognizes source created by this process, never a raw function string.

func (Source) Encode

func (s Source) Encode() string

Encode transports source through existing string fields. The argument stays readable so template rendering can operate on it without losing tag identity.

func (Source) Expression

func (s Source) Expression() string

Expression returns the spelling accepted by explicit evaluation APIs.

Jump to

Keyboard shortcuts

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