Skip to content

Commit c83a824

Browse files
authored
Replace deprecated pkg/errors in favor of Go's standard library (#189)
1 parent 8fa2a4d commit c83a824

File tree

14 files changed

+11
-31
lines changed

14 files changed

+11
-31
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ upgrading. This release will require changes to your application.
171171

172172
### Security
173173

174-
* Update jwt-go to v4 to address CVE-2020-26160 ([#69](https://github.com/auth0/go-jwt-middleware/issues/69))
174+
* Update jwt-go to v4 to address CVE-2020-26160 ([#69](https://github.com/auth0/go-jwt-middleware/issues/69))

error_handler.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package jwtmiddleware
22

33
import (
4+
"errors"
45
"fmt"
56
"net/http"
6-
7-
"github.com/pkg/errors"
87
)
98

109
var (

error_handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package jwtmiddleware
22

33
import (
4+
"errors"
45
"testing"
56

6-
"github.com/pkg/errors"
77
"github.com/stretchr/testify/assert"
88
)
99

examples/gin-example/go.mod

-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ require (
2121
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
2222
github.com/modern-go/reflect2 v1.0.2 // indirect
2323
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
24-
github.com/pkg/errors v0.9.1 // indirect
2524
github.com/ugorji/go/codec v1.2.7 // indirect
2625
golang.org/x/crypto v0.4.0 // indirect
2726
golang.org/x/net v0.7.0 // indirect
2827
golang.org/x/sys v0.5.0 // indirect
2928
golang.org/x/text v0.7.0 // indirect
3029
google.golang.org/protobuf v1.28.0 // indirect
31-
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect
3230
gopkg.in/yaml.v2 v2.4.0 // indirect
3331
)

examples/gin-example/go.sum

+1-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
4141
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
4242
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
4343
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
44-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
45-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
4644
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4745
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4846
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
@@ -53,7 +51,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
5351
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
5452
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
5553
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
56-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
54+
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
5755
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
5856
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
5957
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
@@ -85,7 +83,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
8583
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
8684
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
8785
gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U=
88-
gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
8986
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
9087
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
9188
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

examples/http-example/go.mod

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ require (
99

1010
replace github.com/auth0/go-jwt-middleware/v2 => ./../../
1111

12-
require (
13-
github.com/pkg/errors v0.9.1 // indirect
14-
golang.org/x/crypto v0.4.0 // indirect
15-
)
12+
require golang.org/x/crypto v0.4.0 // indirect

examples/http-example/go.sum

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
22
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
3-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
53
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
4+
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
75
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
86
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
97
gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U=

examples/http-jwks-example/go.mod

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ require (
99

1010
replace github.com/auth0/go-jwt-middleware/v2 => ./../../
1111

12-
require (
13-
github.com/pkg/errors v0.9.1 // indirect
14-
golang.org/x/crypto v0.4.0 // indirect
15-
)
12+
require golang.org/x/crypto v0.4.0 // indirect

examples/http-jwks-example/go.sum

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
22
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
3-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
53
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
6-
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
4+
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
75
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
86
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
97
gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U=

extractor.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package jwtmiddleware
22

33
import (
4+
"errors"
45
"net/http"
56
"strings"
6-
7-
"github.com/pkg/errors"
87
)
98

109
// TokenExtractor is a function that takes a request as input and returns

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.19
44

55
require (
66
github.com/google/go-cmp v0.5.9
7-
github.com/pkg/errors v0.9.1
87
github.com/stretchr/testify v1.8.2
98
gopkg.in/go-jose/go-jose.v2 v2.6.1
109
)

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
55
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
6-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
7-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
86
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
97
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
108
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

middleware_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package jwtmiddleware
22

33
import (
44
"context"
5+
"errors"
56
"io"
67
"net/http"
78
"net/http/httptest"
89
"testing"
910

1011
"github.com/google/go-cmp/cmp"
11-
"github.com/pkg/errors"
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414

validator/validator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package validator
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"time"
78

8-
"github.com/pkg/errors"
99
"gopkg.in/go-jose/go-jose.v2/jwt"
1010
)
1111

0 commit comments

Comments
 (0)