Skip to content

Commit

Permalink
chore: Replace github.com/pkg/errors with Go core error package
Browse files Browse the repository at this point in the history
  • Loading branch information
carstendietrich committed Aug 1, 2024
1 parent 0967167 commit bc63c0a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 142 deletions.
12 changes: 7 additions & 5 deletions frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package httpcache

import (
"context"
"errors"
"fmt"
"time"

"flamingo.me/flamingo/v3/framework/flamingo"
"github.com/pkg/errors"
"go.opencensus.io/trace"
"golang.org/x/sync/singleflight"
)
Expand Down Expand Up @@ -114,12 +114,14 @@ func (f *Frontend) load(ctx context.Context, key string, loader HTTPLoader) (Ent
defer fetchRoutineSpan.End()

defer func() {
// catch potential panics
if err := recover(); err != nil {
if err2, ok := err.(error); ok {
resultErr = errors.WithStack(err2)
} else {
resultErr = errors.WithStack(errors.Errorf("HTTPCache Frontend.load exception: %#v", err))
if typedError, ok := err.(error); ok {
resultErr = typedError
return
}

resultErr = fmt.Errorf("HTTPCache Frontend.load exception: %#v", err)

Check failure on line 124 in frontend.go

View workflow job for this annotation

GitHub Actions / lint

err113: do not define dynamic errors, use wrapped static errors instead: "fmt.Errorf(\"HTTPCache Frontend.load exception: %#v\", err)" (goerr113)
}
}()

Expand Down
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
flamingo.me/flamingo/v3 v3.9.0
github.com/gomodule/redigo v1.9.2
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.32.0
go.opencensus.io v0.24.0
Expand All @@ -36,7 +35,6 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v27.0.3+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
Expand Down Expand Up @@ -67,8 +65,8 @@ require (
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
Expand All @@ -94,12 +92,9 @@ require (
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/api v0.84.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
Expand Down
Loading

0 comments on commit bc63c0a

Please sign in to comment.