From e6aa654a10d34320b26b1d85352e2137a25da8eb Mon Sep 17 00:00:00 2001 From: Kenneth Shaw Date: Wed, 19 Jun 2024 10:48:19 +0700 Subject: [PATCH] Minor cleanup --- client.go | 4 ++-- cmd/verhist/main.go | 4 ++-- verhist.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client.go b/client.go index 7a397b7..b6beabe 100644 --- a/client.go +++ b/client.go @@ -77,14 +77,14 @@ func (cl *Client) Versions(ctx context.Context, platform, channel string, q ...s return res.Versions, nil } -// Latest veturns the latest version for the platform, channel. +// Latest returns the latest version for the platform, channel. func (cl *Client) Latest(ctx context.Context, platform, channel string) (Version, error) { versions, err := cl.Versions(ctx, platform, channel) switch { case err != nil: return Version{}, err case len(versions) == 0: - return Version{}, ErrNoVersionsReturned + return Version{}, ErrNoVersionsAvailable } return versions[0], nil } diff --git a/cmd/verhist/main.go b/cmd/verhist/main.go index 43f1ac7..8e25f5c 100644 --- a/cmd/verhist/main.go +++ b/cmd/verhist/main.go @@ -27,8 +27,8 @@ func run(ctx context.Context, w io.Writer, latest bool, platform, channel string switch { case err != nil: return err - case len(versions) < 1: - return verhist.ErrNoVersionsReturned + case len(versions) == 0: + return verhist.ErrNoVersionsAvailable } if latest { _, err := fmt.Fprintln(w, versions[0].Version) diff --git a/verhist.go b/verhist.go index 3a5f0d6..a6c4183 100644 --- a/verhist.go +++ b/verhist.go @@ -30,7 +30,7 @@ func Versions(ctx context.Context, platform, channel string, opts ...Option) ([] return New(opts...).Versions(ctx, platform, channel) } -// Latest veturns the latest version for the platform, channel. +// Latest returns the latest version for the platform, channel. func Latest(ctx context.Context, platform, channel string, opts ...Option) (Version, error) { return New(opts...).Latest(ctx, platform, channel) } @@ -56,6 +56,6 @@ const ( ErrInvalidChannelType Error = "invalid channel type" // ErrInvalidQuery is the invalid query error. ErrInvalidQuery Error = "invalid query" - // ErrNoVersionsReturned is the no versions returned error. - ErrNoVersionsReturned Error = "no versions returned" + // ErrNoVersionsAvailable is the no versions available error. + ErrNoVersionsAvailable Error = "no versions available" )