diff options
author | Rutger Broekhoff | 2024-01-02 18:56:31 +0100 |
---|---|---|
committer | Rutger Broekhoff | 2024-01-02 18:56:31 +0100 |
commit | 8db41da676ac8368ef7c2549d56239a5ff5eedde (patch) | |
tree | 09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/github.com/golang-jwt/jwt/v5/errors_go1_20.go | |
parent | d4f75fb6db22e57577867445a022227e70958931 (diff) | |
download | gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip |
Delete vendor directory
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.go | 47 |
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 | |||
4 | package jwt | ||
5 | |||
6 | import ( | ||
7 | "fmt" | ||
8 | ) | ||
9 | |||
10 | // Unwrap implements the multiple error unwrapping for this error type, which is | ||
11 | // possible in Go 1.20. | ||
12 | func (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" | ||
29 | func 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 | } | ||