mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 09:02:53 +00:00
remove direct dependency on github/pkg/errors (#4970)
This commit is contained in:
@@ -25,9 +25,9 @@ package util
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.starlark.net/starlark"
|
||||
"go.starlark.net/starlarkstruct"
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
)
|
||||
|
||||
// // asString unquotes a starlark string value
|
||||
@@ -44,6 +44,7 @@ func IsEmptyString(s starlark.String) bool {
|
||||
}
|
||||
|
||||
// Unmarshal decodes a starlark.Value into it's golang counterpart
|
||||
//
|
||||
//nolint:nakedret
|
||||
func Unmarshal(x starlark.Value) (val interface{}, err error) {
|
||||
switch v := x.(type) {
|
||||
@@ -161,7 +162,7 @@ func Unmarshal(x starlark.Value) (val interface{}, err error) {
|
||||
if _var, ok := v.Constructor().(Unmarshaler); ok {
|
||||
err = _var.UnmarshalStarlark(x)
|
||||
if err != nil {
|
||||
err = errors.Wrapf(err, "failed marshal %q to Starlark object", v.Constructor().Type())
|
||||
err = errors.WrapPrefixf(err, "failed marshal %q to Starlark object", v.Constructor().Type())
|
||||
return
|
||||
}
|
||||
val = _var
|
||||
@@ -176,6 +177,7 @@ func Unmarshal(x starlark.Value) (val interface{}, err error) {
|
||||
}
|
||||
|
||||
// Marshal turns go values into starlark types
|
||||
//
|
||||
//nolint:nakedret
|
||||
func Marshal(data interface{}) (v starlark.Value, err error) {
|
||||
switch x := data.(type) {
|
||||
|
||||
Reference in New Issue
Block a user