Skip to content

Commit 00d7e66

Browse files
authored
cmd/app: remove dependency on deprecated github.com/pkg/errors (#598)
* cmd/app: remove dependency on deprecated github.com/pkg/errors Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com> * go.mod: go mod tidy Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
1 parent ef606aa commit 00d7e66

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

cmd/app/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ package app
1717

1818
import (
1919
"context"
20+
"errors"
2021
"fmt"
2122
"net/http"
2223
"strconv"
2324
"strings"
2425
"time"
2526

2627
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
27-
"github.com/pkg/errors"
2828
"github.com/prometheus/client_golang/prometheus/promhttp"
2929
"github.com/sigstore/fulcio/pkg/api"
3030
gw "github.com/sigstore/fulcio/pkg/generated/protobuf"

cmd/app/serve.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727

2828
ctclient "github.com/google/certificate-transparency-go/client"
2929
"github.com/google/certificate-transparency-go/jsonclient"
30-
"github.com/pkg/errors"
3130
"github.com/prometheus/client_golang/prometheus"
3231
"github.com/prometheus/client_golang/prometheus/promhttp"
3332
certauth "github.com/sigstore/fulcio/pkg/ca"
@@ -253,11 +252,11 @@ func runServeCmd(cmd *cobra.Command, args []string) {
253252
func checkServeCmdConfigFile() error {
254253
if serveCmdConfigFilePath != "" {
255254
if _, err := os.Stat(serveCmdConfigFilePath); err != nil {
256-
return errors.Wrap(err, "unable to stat config file provided")
255+
return fmt.Errorf("unable to stat config file provided: %w", err)
257256
}
258257
abspath, err := filepath.Abs(serveCmdConfigFilePath)
259258
if err != nil {
260-
return errors.Wrap(err, "unable to determine absolute path of config file provided")
259+
return fmt.Errorf("unable to determine absolute path of config file provided: %w", err)
261260
}
262261
extWithDot := filepath.Ext(abspath)
263262
ext := strings.TrimPrefix(extWithDot, ".")
@@ -275,7 +274,7 @@ func checkServeCmdConfigFile() error {
275274
viper.SetConfigType(ext)
276275
viper.AddConfigPath(filepath.Dir(serveCmdConfigFilePath))
277276
if err := viper.ReadInConfig(); err != nil {
278-
return errors.Wrap(err, "unable to parse config file provided")
277+
return fmt.Errorf("unable to parse config file provided: %w", err)
279278
}
280279
}
281280
return nil

cmd/app/version.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package app
1818
import (
1919
"fmt"
2020

21-
"github.com/pkg/errors"
2221
"github.com/sigstore/fulcio/pkg/api"
2322
"github.com/spf13/cobra"
2423
)
@@ -50,7 +49,7 @@ func runVersion(opts *versionOptions) error {
5049
if opts.json {
5150
j, err := v.JSONString()
5251
if err != nil {
53-
return errors.Wrap(err, "unable to generate JSON from version info")
52+
return fmt.Errorf("unable to generate JSON from version info: %w", err)
5453
}
5554
res = j
5655
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ require (
1717
github.com/grpc-ecosystem/grpc-gateway/v2 v2.10.0
1818
github.com/hashicorp/golang-lru v0.5.4
1919
github.com/magiconair/properties v1.8.6
20-
github.com/pkg/errors v0.9.1
2120
github.com/prometheus/client_golang v1.12.2
2221
github.com/prometheus/client_model v0.2.0
2322
github.com/prometheus/common v0.34.0
@@ -130,6 +129,7 @@ require (
130129
github.com/pelletier/go-toml v1.9.4 // indirect
131130
github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect
132131
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
132+
github.com/pkg/errors v0.9.1 // indirect
133133
github.com/prometheus/procfs v0.7.3 // indirect
134134
github.com/rivo/uniseg v0.2.0 // indirect
135135
github.com/russross/blackfriday/v2 v2.1.0 // indirect

0 commit comments

Comments
 (0)