From 9aabd619e72de9cee3028d6f0233e314bfc01f10 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Fri, 20 May 2022 05:30:43 +0900 Subject: [PATCH 1/2] cmd/app: remove dependency on deprecated github.com/pkg/errors Signed-off-by: Koichi Shiraishi --- cmd/app/http.go | 2 +- cmd/app/serve.go | 7 +++---- cmd/app/version.go | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/cmd/app/http.go b/cmd/app/http.go index ff4209e54..961a09e98 100644 --- a/cmd/app/http.go +++ b/cmd/app/http.go @@ -17,6 +17,7 @@ package app import ( "context" + "errors" "fmt" "net/http" "strconv" @@ -24,7 +25,6 @@ import ( "time" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/sigstore/fulcio/pkg/api" gw "github.com/sigstore/fulcio/pkg/generated/protobuf" diff --git a/cmd/app/serve.go b/cmd/app/serve.go index 53064411a..619f0f9b1 100644 --- a/cmd/app/serve.go +++ b/cmd/app/serve.go @@ -27,7 +27,6 @@ import ( ctclient "github.com/google/certificate-transparency-go/client" "github.com/google/certificate-transparency-go/jsonclient" - "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" certauth "github.com/sigstore/fulcio/pkg/ca" @@ -253,11 +252,11 @@ func runServeCmd(cmd *cobra.Command, args []string) { func checkServeCmdConfigFile() error { if serveCmdConfigFilePath != "" { if _, err := os.Stat(serveCmdConfigFilePath); err != nil { - return errors.Wrap(err, "unable to stat config file provided") + return fmt.Errorf("unable to stat config file provided: %w", err) } abspath, err := filepath.Abs(serveCmdConfigFilePath) if err != nil { - return errors.Wrap(err, "unable to determine absolute path of config file provided") + return fmt.Errorf("unable to determine absolute path of config file provided: %w", err) } extWithDot := filepath.Ext(abspath) ext := strings.TrimPrefix(extWithDot, ".") @@ -275,7 +274,7 @@ func checkServeCmdConfigFile() error { viper.SetConfigType(ext) viper.AddConfigPath(filepath.Dir(serveCmdConfigFilePath)) if err := viper.ReadInConfig(); err != nil { - return errors.Wrap(err, "unable to parse config file provided") + return fmt.Errorf("unable to parse config file provided: %w", err) } } return nil diff --git a/cmd/app/version.go b/cmd/app/version.go index d4fb7d37f..69a929400 100644 --- a/cmd/app/version.go +++ b/cmd/app/version.go @@ -18,7 +18,6 @@ package app import ( "fmt" - "github.com/pkg/errors" "github.com/sigstore/fulcio/pkg/api" "github.com/spf13/cobra" ) @@ -50,7 +49,7 @@ func runVersion(opts *versionOptions) error { if opts.json { j, err := v.JSONString() if err != nil { - return errors.Wrap(err, "unable to generate JSON from version info") + return fmt.Errorf("unable to generate JSON from version info: %w", err) } res = j } From 411ff791ff9f0b400c6f2d4cea0df5132af795b8 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Fri, 20 May 2022 05:56:56 +0900 Subject: [PATCH 2/2] go.mod: go mod tidy Signed-off-by: Koichi Shiraishi --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 07cac6b3b..ccabb05a0 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0 github.com/hashicorp/golang-lru v0.5.4 github.com/magiconair/properties v1.8.6 - github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.12.2 github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.34.0 @@ -130,6 +129,7 @@ require ( github.com/pelletier/go-toml v1.9.4 // indirect github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect