yaml

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0, BSD-3-Clause, MIT Imports: 1 Imported by: 20

README

goyaml.v2

This package provides type and function aliases for the go.yaml.in/yaml/v2 package (which is compatible with gopkg.in/yaml.v2).

Purpose

The purpose of this package is to:

  1. Provide a transition path for users migrating from the sigs.k8s.io/yaml package to direct usage of go.yaml.in/yaml/v2
  2. Maintain compatibility with existing code while encouraging migration to the upstream package
  3. Reduce maintenance overhead by delegating to the upstream implementation

Usage

Instead of importing this package directly, you should migrate to using go.yaml.in/yaml/v2 directly:

// Old way
import "sigs.k8s.io/yaml/goyaml.v2"

// Recommended way
import "go.yaml.in/yaml/v2"

Available Types and Functions

All public types and functions from go.yaml.in/yaml/v2 are available through this package:

Types
  • MapSlice - Encodes and decodes as a YAML map with preserved key order
  • MapItem - An item in a MapSlice
  • Unmarshaler - Interface for custom unmarshaling behavior
  • Marshaler - Interface for custom marshaling behavior
  • IsZeroer - Interface to check if an object is zero
  • Decoder - Reads and decodes YAML values from an input stream
  • Encoder - Writes YAML values to an output stream
  • TypeError - Error returned by Unmarshal for decoding issues
Functions
  • Unmarshal - Decodes YAML data into a Go value
  • UnmarshalStrict - Like Unmarshal but errors on unknown fields
  • Marshal - Serializes a Go value into YAML
  • NewDecoder - Creates a new Decoder
  • NewEncoder - Creates a new Encoder
  • FutureLineWrap - Controls line wrapping behavior

Migration Guide

To migrate from this package to go.yaml.in/yaml/v2:

  1. Update your import statements:

    // From
    import "sigs.k8s.io/yaml/goyaml.v2"
    
    // To
    import "go.yaml.in/yaml/v2"
    
  2. No code changes should be necessary as the API is identical

  3. Update your go.mod file to include the dependency:

    require go.yaml.in/yaml/v2 v2.4.2
    

Deprecation Notice

All types and functions in this package are marked as deprecated. You should migrate to using go.yaml.in/yaml/v2 directly.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Unmarshal decodes the first document found within the in byte slice and assigns decoded values into the out value.
	// Deprecated: Use go.yaml.in/yaml/v2.Unmarshal directly.
	Unmarshal = gopkg_yaml.Unmarshal

	// UnmarshalStrict is like Unmarshal except that any fields that are found in the data that do not have corresponding struct members will result in an error.
	// Deprecated: Use go.yaml.in/yaml/v2.UnmarshalStrict directly.
	UnmarshalStrict = gopkg_yaml.UnmarshalStrict

	// Marshal serializes the value provided into a YAML document.
	// Deprecated: Use go.yaml.in/yaml/v2.Marshal directly.
	Marshal = gopkg_yaml.Marshal

	// NewDecoder returns a new decoder that reads from r.
	// Deprecated: Use go.yaml.in/yaml/v2.NewDecoder directly.
	NewDecoder = gopkg_yaml.NewDecoder

	// NewEncoder returns a new encoder that writes to w.
	// Deprecated: Use go.yaml.in/yaml/v2.NewEncoder directly.
	NewEncoder = gopkg_yaml.NewEncoder

	// FutureLineWrap globally disables line wrapping when encoding long strings.
	// Deprecated: Use go.yaml.in/yaml/v2.FutureLineWrap directly.
	FutureLineWrap = gopkg_yaml.FutureLineWrap
)

Function aliases for public functions from go.yaml.in/yaml/v2

Functions

This section is empty.

Types

type Decoder

type Decoder = gopkg_yaml.Decoder

Decoder reads and decodes YAML values from an input stream. Deprecated: Use go.yaml.in/yaml/v2.Decoder directly.

type Encoder

type Encoder = gopkg_yaml.Encoder

Encoder writes YAML values to an output stream. Deprecated: Use go.yaml.in/yaml/v2.Encoder directly.

type IsZeroer

type IsZeroer = gopkg_yaml.IsZeroer

IsZeroer is used to check whether an object is zero to determine whether it should be omitted when marshaling with the omitempty flag. One notable implementation is time.Time. Deprecated: Use go.yaml.in/yaml/v2.IsZeroer directly.

type MapItem

type MapItem = gopkg_yaml.MapItem

MapItem is an item in a MapSlice. Deprecated: Use go.yaml.in/yaml/v2.MapItem directly.

type MapSlice

type MapSlice = gopkg_yaml.MapSlice

MapSlice encodes and decodes as a YAML map. The order of keys is preserved when encoding and decoding. Deprecated: Use go.yaml.in/yaml/v2.MapSlice directly.

type Marshaler

type Marshaler = gopkg_yaml.Marshaler

Marshaler is implemented by types to customize their behavior when being marshaled into a YAML document. Deprecated: Use go.yaml.in/yaml/v2.Marshaler directly.

type TypeError

type TypeError = gopkg_yaml.TypeError

TypeError is returned by Unmarshal when one or more fields in the YAML document cannot be properly decoded. Deprecated: Use go.yaml.in/yaml/v2.TypeError directly.

type Unmarshaler

type Unmarshaler = gopkg_yaml.Unmarshaler

Unmarshaler is implemented by types to customize their behavior when being unmarshaled from a YAML document. Deprecated: Use go.yaml.in/yaml/v2.Unmarshaler directly.

Jump to

Keyboard shortcuts

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