starlarksource

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package starlarksource preserves configuration source and its original location through stack merges and YAML serialization, without importing an interpreter.

Index

Constants

View Source
const (
	Tag = "!starlark"
)

Variables

This section is empty.

Functions

func Is

func Is(value string) bool

Is reports whether value is a complete Starlark tag followed by its body.

func IsEncoded

func IsEncoded(value string) bool

IsEncoded reports whether value was produced by the YAML loader's !starlark tag. Unlike Is, it requires source identity written by Encode, so an ordinary string that merely begins with the tag text (a quoted scalar or included file) remains data.

func Protect

func Protect(input, file string) (string, func(string) string, error)

Protect hides Starlark source and explicit literal scalars from Go template evaluation. The returned restore function reinserts readable source after all template passes finish. YAML without protected source is returned unchanged.

Types

type Source

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

Source is an inline function body with its original YAML location.

func Decode

func Decode(value string) Source

Decode accepts loader-preserved source or a manually supplied tagged string.

func FromNode

func FromNode(node *yaml.Node, file string) Source

FromNode records the first source line, accounting for YAML's block indicator.

func (Source) Encode

func (s Source) Encode() string

Encode preserves the body and location using the shared YAML source transport.

Jump to

Keyboard shortcuts

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