aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go')
-rw-r--r--vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go b/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go
deleted file mode 100644
index a893d35..0000000
--- a/vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go
+++ /dev/null
@@ -1,47 +0,0 @@
1//go:build go1.20
2// +build go1.20
3
4package jwt
5
6import (
7 "fmt"
8)
9
10// Unwrap implements the multiple error unwrapping for this error type, which is
11// possible in Go 1.20.
12func (je joinedError) Unwrap() []error {
13 return je.errs
14}
15
16// newError creates a new error message with a detailed error message. The
17// message will be prefixed with the contents of the supplied error type.
18// Additionally, more errors, that provide more context can be supplied which
19// will be appended to the message. This makes use of Go 1.20's possibility to
20// include more than one %w formatting directive in [fmt.Errorf].
21//
22// For example,
23//
24// newError("no keyfunc was provided", ErrTokenUnverifiable)
25//
26// will produce the error string
27//
28// "token is unverifiable: no keyfunc was provided"
29func newError(message string, err error, more ...error) error {
30 var format string
31 var args []any
32 if message != "" {
33 format = "%w: %s"
34 args = []any{err, message}
35 } else {
36 format = "%w"
37 args = []any{err}
38 }
39
40 for _, e := range more {
41 format += ": %w"
42 args = append(args, e)
43 }
44
45 err = fmt.Errorf(format, args...)
46 return err
47}