Skip to content

Commit

Permalink
Remove pkg/errors dependency (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
husio authored Jan 21, 2022
1 parent b69cbb3 commit e40f234
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
7 changes: 3 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
//go:build go1.7
// +build go1.7

package csrf

import (
"context"
"fmt"
"net/http"

"github.com/pkg/errors"
)

func contextGet(r *http.Request, key string) (interface{}, error) {
val := r.Context().Value(key)
if val == nil {
return nil, errors.Errorf("no value exists in the context for key %q", key)
return nil, fmt.Errorf("no value exists in the context for key %q", key)
}

return val, nil
}

Expand Down
3 changes: 1 addition & 2 deletions csrf.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package csrf

import (
"errors"
"fmt"
"net/http"
"net/url"

"github.com/pkg/errors"

"github.com/gorilla/securecookie"
)

Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module github.com/gorilla/csrf

require (
github.com/gorilla/securecookie v1.1.1
github.com/pkg/errors v0.9.1
)
require github.com/gorilla/securecookie v1.1.1

go 1.13
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
1 change: 1 addition & 0 deletions store.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build go1.11
// +build go1.11

package csrf
Expand Down
2 changes: 2 additions & 0 deletions store_legacy.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//go:build !go1.11
// +build !go1.11

// file for compatibility with go versions prior to 1.11

package csrf
Expand Down
5 changes: 3 additions & 2 deletions store_legacy_test.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
//go:build !go1.11
// +build !go1.11

// file for compatibility with go versions prior to 1.11

package csrf

import (
"errors"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"

"github.com/pkg/errors"

"github.com/gorilla/securecookie"
)

Expand Down
4 changes: 2 additions & 2 deletions store_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//go:build go1.11
// +build go1.11

package csrf

import (
"errors"
"fmt"
"net/http"
"net/http/httptest"
"strings"
"testing"

"github.com/pkg/errors"

"github.com/gorilla/securecookie"
)

Expand Down

0 comments on commit e40f234

Please sign in to comment.