remove direct dependency on github/pkg/errors (#4970)

This commit is contained in:
Cailyn
2023-01-13 13:52:25 -05:00
committed by GitHub
parent 2b7eb6d92a
commit 8ab4b8d167
38 changed files with 137 additions and 143 deletions

View File

@@ -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) {