From 27f2f3fb779a7cd684145c09937b4ee8976e2589 Mon Sep 17 00:00:00 2001 From: lestrrat <49281+lestrrat@users.noreply.github.com> Date: Mon, 11 Nov 2024 16:50:18 +0900 Subject: [PATCH] Lint fix (#1235) * fix error name * tweak interface * disable recvcheck --------- Co-authored-by: Daisuke Maki --- .golangci.yml | 1 + jwk/cache.go | 1 + jwt/errors.go | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b6cc945a..7c49a522 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -41,6 +41,7 @@ linters: - nonamedreturns # visit this back later - paralleltest - perfsprint + - recvcheck - tagliatelle - testifylint # TODO: revisit when we have the chance - testpackage diff --git a/jwk/cache.go b/jwk/cache.go index fd0337bf..4eef5c43 100644 --- a/jwk/cache.go +++ b/jwk/cache.go @@ -229,6 +229,7 @@ func (c *Cache) Unregister(ctx context.Context, u string) error { // Make sure that you read the documentation for `jwk.Cache` as well. type CachedSet interface { Set + cached() (Set, error) // used as a marker } type cachedSet struct { diff --git a/jwt/errors.go b/jwt/errors.go index df647153..670fcb50 100644 --- a/jwt/errors.go +++ b/jwt/errors.go @@ -111,20 +111,20 @@ func TokenExpiredError() error { return errDefaultTokenExpired } -type invalidIssuedAt struct { +type invalidIssuedAtError struct { error } -func (err invalidIssuedAt) Is(target error) bool { - _, ok := target.(invalidIssuedAt) +func (err invalidIssuedAtError) Is(target error) bool { + _, ok := target.(invalidIssuedAtError) return ok } -func (err invalidIssuedAt) Unwrap() error { +func (err invalidIssuedAtError) Unwrap() error { return err.error } -var errDefaultInvalidIssuedAt = invalidIssuedAt{errors.New(`"iat" not satisfied`)} +var errDefaultInvalidIssuedAt = invalidIssuedAtError{errors.New(`"iat" not satisfied`)} // InvalidIssuedAtError returns the immutable error used when `iat` claim // is not satisfied