From 8942536a0b7031feb6f37b5323a222e9b184a3b2 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 22 Feb 2024 21:33:21 +0000 Subject: [PATCH] Make only referenc of ErrUnknownVersion an error (#648) just a refactor nit Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/648 Reviewed-by: John Olheiser --- forgejo/version.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/forgejo/version.go b/forgejo/version.go index dc42117..2fd7a14 100644 --- a/forgejo/version.go +++ b/forgejo/version.go @@ -81,14 +81,13 @@ type ErrUnknownVersion struct { } // Error fulfills error -func (e ErrUnknownVersion) Error() string { +func (e *ErrUnknownVersion) Error() string { return fmt.Sprintf("unknown version: %s", e.raw) } -func (ErrUnknownVersion) Is(target error) bool { - _, ok1 := target.(*ErrUnknownVersion) - _, ok2 := target.(ErrUnknownVersion) - return ok1 || ok2 +func (*ErrUnknownVersion) Is(target error) bool { + _, ok := target.(*ErrUnknownVersion) + return ok } // checkServerVersionGreaterThanOrEqual is the canonical way in the SDK to check for versions for API compatibility reasons