Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kenshaw committed Jun 19, 2024
1 parent 9dd0666 commit e6aa654
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/verhist/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions verhist.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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"
)

0 comments on commit e6aa654

Please sign in to comment.