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