This package provides type and function aliases for the go.yaml.in/yaml/v2 package (which is compatible with gopkg.in/yaml.v2).
The purpose of this package is to:
- Provide a transition path for users migrating from the sigs.k8s.io/yaml package to direct usage of go.yaml.in/yaml/v2
- Maintain compatibility with existing code while encouraging migration to the upstream package
- Reduce maintenance overhead by delegating to the upstream implementation
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"All public types and functions from go.yaml.in/yaml/v2 are available through this package:
MapSlice- Encodes and decodes as a YAML map with preserved key orderMapItem- An item in a MapSliceUnmarshaler- Interface for custom unmarshaling behaviorMarshaler- Interface for custom marshaling behaviorIsZeroer- Interface to check if an object is zeroDecoder- Reads and decodes YAML values from an input streamEncoder- Writes YAML values to an output streamTypeError- Error returned by Unmarshal for decoding issues
Unmarshal- Decodes YAML data into a Go valueUnmarshalStrict- Like Unmarshal but errors on unknown fieldsMarshal- Serializes a Go value into YAMLNewDecoder- Creates a new DecoderNewEncoder- Creates a new EncoderFutureLineWrap- Controls line wrapping behavior
To migrate from this package to go.yaml.in/yaml/v2:
-
Update your import statements:
// From import "sigs.k8s.io/yaml/goyaml.v2" // To import "go.yaml.in/yaml/v2"
-
No code changes should be necessary as the API is identical
-
Update your go.mod file to include the dependency:
require go.yaml.in/yaml/v2 v2.4.2
All types and functions in this package are marked as deprecated. You should migrate to using go.yaml.in/yaml/v2 directly.