mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-17 16:58:04 +08:00
vendor: bump k8s to v0.25.4
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
28
vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
generated
vendored
28
vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
generated
vendored
@@ -59,6 +59,34 @@ func Unmarshal(data []byte, v interface{}) error {
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalStrict unmarshals the given data
|
||||
// strictly (erroring when there are duplicate fields).
|
||||
func UnmarshalStrict(data []byte, v interface{}) error {
|
||||
preserveIntFloat := func(d *json.Decoder) *json.Decoder {
|
||||
d.UseNumber()
|
||||
return d
|
||||
}
|
||||
switch v := v.(type) {
|
||||
case *map[string]interface{}:
|
||||
if err := yaml.UnmarshalStrict(data, v, preserveIntFloat); err != nil {
|
||||
return err
|
||||
}
|
||||
return jsonutil.ConvertMapNumbers(*v, 0)
|
||||
case *[]interface{}:
|
||||
if err := yaml.UnmarshalStrict(data, v, preserveIntFloat); err != nil {
|
||||
return err
|
||||
}
|
||||
return jsonutil.ConvertSliceNumbers(*v, 0)
|
||||
case *interface{}:
|
||||
if err := yaml.UnmarshalStrict(data, v, preserveIntFloat); err != nil {
|
||||
return err
|
||||
}
|
||||
return jsonutil.ConvertInterfaceNumbers(v, 0)
|
||||
default:
|
||||
return yaml.UnmarshalStrict(data, v)
|
||||
}
|
||||
}
|
||||
|
||||
// ToJSON converts a single YAML document into a JSON document
|
||||
// or returns an error. If the document appears to be JSON the
|
||||
// YAML decoding path is not used (so that error messages are
|
||||
|
Reference in New Issue
Block a user