strictyaml

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 5 Imported by: 0 modules, 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 strictyaml decodes YAML configuration that must hold exactly one document with no unknown keys, so a misspelled key or a stray document fails instead of being ignored.

Index

Constants

This section is empty.

Variables

View Source
var ErrEmpty = errors.New("the file holds no YAML document")

ErrEmpty reports data with no YAML document holding content, such as an empty file, one of only comments, or a bare separator. A loader that accepts an empty file ignores it.

Functions

func Decode

func Decode(data []byte, out any) error

Decode decodes the one document in data with content into out, failing on a key out has no field for or on a second document with content. It skips documents that hold nothing, such as a bare separator or a comment-only header, and returns ErrEmpty when no other document remains.

func HasTopLevelKey

func HasTopLevelKey(data []byte, keys ...string) bool

HasTopLevelKey reports whether the document Decode would pick has one of keys at its top level. Data that is empty, malformed, or holds more than one document with content has none.

Types

This section is empty.

Jump to

Keyboard shortcuts

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