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 <jolheiser@noreply.gitea.com>
This commit is contained in:
6543 2024-02-22 21:33:21 +00:00 committed by Martijn van der Kleijn
parent f4c493667c
commit 8942536a0b

View file

@ -81,14 +81,13 @@ type ErrUnknownVersion struct {
} }
// Error fulfills error // Error fulfills error
func (e ErrUnknownVersion) Error() string { func (e *ErrUnknownVersion) Error() string {
return fmt.Sprintf("unknown version: %s", e.raw) return fmt.Sprintf("unknown version: %s", e.raw)
} }
func (ErrUnknownVersion) Is(target error) bool { func (*ErrUnknownVersion) Is(target error) bool {
_, ok1 := target.(*ErrUnknownVersion) _, ok := target.(*ErrUnknownVersion)
_, ok2 := target.(ErrUnknownVersion) return ok
return ok1 || ok2
} }
// checkServerVersionGreaterThanOrEqual is the canonical way in the SDK to check for versions for API compatibility reasons // checkServerVersionGreaterThanOrEqual is the canonical way in the SDK to check for versions for API compatibility reasons