From 5342b6b482bab9611a1b2880a57f6778e3c3175a Mon Sep 17 00:00:00 2001 From: Eron Wright Date: Fri, 10 May 2024 11:07:14 -0700 Subject: [PATCH] use fmt.errorf --- provider/pkg/helm/keyring.go | 5 +++-- provider/pkg/helm/values.go | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/provider/pkg/helm/keyring.go b/provider/pkg/helm/keyring.go index 4fff0993c9..97f8c0b6cf 100644 --- a/provider/pkg/helm/keyring.go +++ b/provider/pkg/helm/keyring.go @@ -15,6 +15,7 @@ package helm import ( + "fmt" "net/url" "os" @@ -50,11 +51,11 @@ func LocateKeyring(p getter.Providers, asset pulumi.Asset) (string, error) { } g, err := p.ByScheme(u.Scheme) if err != nil { - return "", errors.Wrapf(err, "no protocol handler for uri %q", asset.URI()) + return "", fmt.Errorf("no protocol handler for uri %q", asset.URI()) } data, err := g.Get(asset.URI(), getter.WithURL(asset.URI())) if err != nil { - return "", errors.Wrapf(err, "failed to read uri %q", asset.URI()) + return "", fmt.Errorf("failed to read uri %q: %w", asset.URI(), err) } return makeTemp(data.Bytes()) default: diff --git a/provider/pkg/helm/values.go b/provider/pkg/helm/values.go index ab38f98097..8e11702b65 100644 --- a/provider/pkg/helm/values.go +++ b/provider/pkg/helm/values.go @@ -15,6 +15,7 @@ package helm import ( + "fmt" "net/url" "os" @@ -70,7 +71,7 @@ func readAsset(p getter.Providers, asset pulumi.Asset) ([]byte, error) { case asset.Path() != "": bytes, err := os.ReadFile(asset.Path()) if err != nil { - return nil, errors.Wrapf(err, "failed to read file %q", asset.Path()) + return nil, fmt.Errorf("failed to read file %q: %w", asset.Path(), err) } return bytes, nil case asset.URI() != "": @@ -80,11 +81,11 @@ func readAsset(p getter.Providers, asset pulumi.Asset) ([]byte, error) { } g, err := p.ByScheme(u.Scheme) if err != nil { - return nil, errors.Wrapf(err, "no protocol handler for uri %q", asset.URI()) + return nil, fmt.Errorf("no protocol handler for uri %q", asset.URI()) } data, err := g.Get(asset.URI(), getter.WithURL(asset.URI())) if err != nil { - return nil, errors.Wrapf(err, "failed to read uri %q", asset.URI()) + return nil, fmt.Errorf("failed to read uri %q: %w", asset.URI(), err) } return data.Bytes(), nil default: