plugin

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 0 Imported by: ? 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 plugin provides official YAML plugins for go-yaml.

Plugins extend the core YAML library with optional processing capabilities. This package contains official plugin implementations maintained by the go-yaml project.

Available Plugins

Alias-Data plugin (plugin/aliasdata), API alias-data:

  • Per-stream anchor policy, external data, and optional stream scope
  • Default document scope preserves ordinary v4 aliases
  • Disabling the API rejects references, not anchor declarations

Loader-limits plugin (plugin/loaderlimits), API loader-limits:

  • Configurable depth and alias expansion limits

Merge-Key plugin (plugin/mergekey), API merge-key:

  • Disable merging, combine repeated directives, and select conflict policy
  • Replace the mapping merge algorithm with a third-party implementation

Tab indentation plugin (plugin/tabindent), API tab-indent:

  • Tab-aware structural indentation for loading and dumping

Reference YAML-parser plugin (plugin/yamlparser/reference), API yaml-parser:

  • Optional YAMLStar reference parser implementation

The reference YAML-parser package is a separate Go module so its dependencies remain optional.

ErrorFormat plugins (plugin/errorformat/v3 and plugin/errorformat/v4):

  • Versioned YAML load and dump error message formatting

Usage

Import the plugin you need and register it with WithPlugin:

import "github.com/pb33f/go-yaml"
import "github.com/pb33f/go-yaml/plugin/loaderlimits"
import errorformatv3 "github.com/pb33f/go-yaml/plugin/errorformat/v3"

// Disable alias checking for documents with many aliases
loader, err := yaml.NewLoader(reader,
    yaml.WithPlugin(loaderlimits.New(loaderlimits.AliasNone())))
if err != nil {
    return err
}

// Use legacy error format (yaml: line N: msg)
loader, err = yaml.NewLoader(reader, yaml.WithPlugin(errorformatv3.New()))
if err != nil {
    return err
}

Third-Party Plugins

Plugin interfaces use public types and can be implemented by external packages. Implement the relevant plugin interface (e.g., LoaderLimitsPlugin) and register with WithPlugin.

Directories

Path Synopsis
Package aliasdata supplies node-based YAML anchor and alias policies.
Package aliasdata supplies node-based YAML anchor and alias policies.
Package errorformat contains versioned YAML load and dump error formatting plugins.
Package errorformat contains versioned YAML load and dump error formatting plugins.
v3
Package errorformatv3 provides the go-yaml v3-compatible error formatter.
Package errorformatv3 provides the go-yaml v3-compatible error formatter.
v4
Package errorformatv4 provides the go-yaml v4 error formatter.
Package errorformatv4 provides the go-yaml v4 error formatter.
Package loaderlimits provides configurable loader limits for go-yaml.
Package loaderlimits provides configurable loader limits for go-yaml.
Package mergekey supplies the standard shallow Merge-Key algorithm.
Package mergekey supplies the standard shallow Merge-Key algorithm.
Package tabindent configures structural YAML indentation.
Package tabindent configures structural YAML indentation.

Jump to

Keyboard shortcuts

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