1//go:build !testify_yaml_fail && !testify_yaml_custom
2// +build !testify_yaml_fail,!testify_yaml_custom
3
4// Package yaml is just an indirection to handle YAML deserialization.
5//
6// This package is just an indirection that allows the builder to override the
7// indirection with an alternative implementation of this package that uses
8// another implementation of YAML deserialization. This allows to not either not
9// use YAML deserialization at all, or to use another implementation than
10// [gopkg.in/yaml.v3] (for example for license compatibility reasons, see [PR #1120]).
11//
12// Alternative implementations are selected using build tags:
13//
14// - testify_yaml_fail: [Unmarshal] always fails with an error
15// - testify_yaml_custom: [Unmarshal] is a variable. Caller must initialize it
16// before calling any of [github.com/stretchr/testify/assert.YAMLEq] or
17// [github.com/stretchr/testify/assert.YAMLEqf].
18//
19// Usage:
20//
21// go test -tags testify_yaml_fail
22//
23// You can check with "go list" which implementation is linked:
24//
25// go list -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml
26// go list -tags testify_yaml_fail -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml
27// go list -tags testify_yaml_custom -f '{{.Imports}}' github.com/stretchr/testify/assert/yaml
28//
29// [PR #1120]: https://github.com/stretchr/testify/pull/1120
30package yaml
31
32import goyaml "gopkg.in/yaml.v3"
33
34// Unmarshal is just a wrapper of [gopkg.in/yaml.v3.Unmarshal].
35func Unmarshal(in []byte, out interface{}) error {
36 return goyaml.Unmarshal(in, out)
37}