Source File
errors_go1_20.go
Belonging Package
github.com/golang-jwt/jwt/v5
//go:build go1.20
// +build go1.20
package jwt
import (
)
// Unwrap implements the multiple error unwrapping for this error type, which is
// possible in Go 1.20.
func ( joinedError) () []error {
return .errs
}
// newError creates a new error message with a detailed error message. The
// message will be prefixed with the contents of the supplied error type.
// Additionally, more errors, that provide more context can be supplied which
// will be appended to the message. This makes use of Go 1.20's possibility to
// include more than one %w formatting directive in [fmt.Errorf].
//
// For example,
//
// newError("no keyfunc was provided", ErrTokenUnverifiable)
//
// will produce the error string
//
// "token is unverifiable: no keyfunc was provided"
func ( string, error, ...error) error {
var string
var []any
if != "" {
= "%w: %s"
= []any{, }
} else {
= "%w"
= []any{}
}
for , := range {
+= ": %w"
= append(, )
}
= fmt.Errorf(, ...)
return
}
![]() |
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |