utils

package
v0.255.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 6 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadYAML

func LoadYAML[T any](path, label string, defaults func() *T) (*T, error)

LoadYAML reads path to run with: ${VAR} references resolve from the environment before unmarshalling, and a literal `${…}` must be escaped as `$$…`. A missing file yields defaults(). label scopes error messages, e.g. "channels" produces "failed to read channels config: …".

func LoadYAMLAsWritten added in v0.250.0

func LoadYAMLAsWritten[T any](path, label string, defaults func() *T) (*T, error)

LoadYAMLAsWritten reads path to edit: every ${VAR} reference stays as written, so saving the result back never puts a variable's value in its place. A missing file yields defaults().

func SaveYAML

func SaveYAML[T any](path, label string, cfg *T) error

SaveYAML writes cfg to path, creating any missing parent directories. It always emits the YAML document marker `---\n` and uses 2-space indent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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