Skip to content

Commit

Permalink
get rid of errors package dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed May 21, 2022
1 parent 93318ee commit e9d36b6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
4 changes: 1 addition & 3 deletions cache.go
Expand Up @@ -17,8 +17,6 @@ import (
"fmt"
"sync"
"time"

"github.com/pkg/errors"
)

// Cache defines cache interface
Expand Down Expand Up @@ -73,7 +71,7 @@ func NewCache(options ...Option) (Cache, error) {

for _, opt := range options {
if err := opt(&res); err != nil {
return nil, errors.Wrap(err, "failed to set cache option")
return nil, fmt.Errorf("failed to set cache option: %w", err)
}
}
return &res, nil
Expand Down
3 changes: 1 addition & 2 deletions cache_test.go
Expand Up @@ -6,7 +6,6 @@ import (
"testing"
"time"

"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -135,7 +134,7 @@ func TestCacheInvalidateAndEvict(t *testing.T) {

func TestCacheBadOption(t *testing.T) {
lc, err := NewCache(func(lc *cacheImpl) error {
return errors.New("mock err")
return fmt.Errorf("mock err")
})
assert.EqualError(t, err, "failed to set cache option: mock err")
assert.Nil(t, lc)
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Expand Up @@ -2,7 +2,4 @@ module github.com/go-pkgz/expirable-cache

go 1.14

require (
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0
)
require github.com/stretchr/testify v1.7.1
6 changes: 2 additions & 4 deletions go.sum
@@ -1,12 +1,10 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
Expand Down

0 comments on commit e9d36b6

Please sign in to comment.