Skip to content

Commit

Permalink
chore(deps): replace github.com/pkg/errors with standard errors package
Browse files Browse the repository at this point in the history
Signed-off-by: walnuts1018 <r.juglans.1018@gmail.com>
  • Loading branch information
walnuts1018 committed Feb 8, 2025
1 parent 257a61a commit f4bd2a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/infrautil/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/google/go-jsonnet v0.20.0
github.com/google/subcommands v1.2.0
github.com/phsym/console-slog v0.3.1
github.com/pkg/errors v0.9.1
github.com/sters/yaml-diff v1.4.1
github.com/yosuke-furukawa/json5 v0.1.1
golang.org/x/sync v0.11.0
Expand Down Expand Up @@ -105,6 +104,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions scripts/infrautil/lib/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package lib
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"log/slog"
"net/url"
"os"
"strings"

"github.com/pkg/errors"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
Expand Down Expand Up @@ -152,7 +152,7 @@ func (h *HelmClient) createRelease(
// As of Helm 2.4.0, this is treated as a stopping condition:
// https://github.com/helm/helm/issues/2209
if err := action.CheckDependencies(chartRequested, req); err != nil {
err = errors.Wrap(err, "An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies")
err = fmt.Errorf("An error occurred while checking for chart dependencies. You may need to run `helm dependency build` to fetch missing dependencies: %w", err)
if h.client.DependencyUpdate {
man := &downloader.Manager{
Out: os.Stdout,
Expand All @@ -166,11 +166,11 @@ func (h *HelmClient) createRelease(
RegistryClient: h.client.GetRegistryClient(),
}
if err := man.Update(); err != nil {
return nil, errors.Wrap(err, "failed to update chart dependencies")
return nil, fmt.Errorf("failed to update chart dependencies: %w", err)
}
// Reload the chart with the updated Chart.lock file.
if chartRequested, err = loader.Load(cp); err != nil {
return nil, errors.Wrap(err, "failed reloading chart after repo update")
return nil, fmt.Errorf("failed to reload chart after repo update: %w", err)
}
} else {
return nil, err
Expand All @@ -194,7 +194,7 @@ func createValues(valuesString string, valuesObject map[string]interface{}) (map
if valuesString != "" {
currentMap := map[string]interface{}{}
if err := yaml.Unmarshal([]byte(valuesString), &currentMap); err != nil {
return nil, errors.Wrap(err, "failed to parse values string")
return nil, fmt.Errorf("failed to parse values string: %w", err)
}
result = mergeMaps(result, currentMap)
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func checkIfInstallable(ch *chart.Chart) error {
case "", "application":
return nil
}
return errors.Errorf("%s charts are not installable", ch.Metadata.Type)
return fmt.Errorf("%s charts are not installable", ch.Metadata.Type)
}

// From: https://github.com/argoproj/argo-cd/blob/db8d2f08d926c9f811a3d4f26d2883856e135e38/util/helm/client.go#L397-L404
Expand Down

0 comments on commit f4bd2a0

Please sign in to comment.