Skip to content

Commit

Permalink
Fix minor style issues (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
fweikert committed Sep 6, 2022
1 parent 31cf2a3 commit c044e94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const (
// DownloadFunc downloads a specific Bazel binary to the given location and returns the absolute path.
type DownloadFunc func(destDir, destFile string) (string, error)

// ReleaseFilter filters Bazel versions based on specific criteria.
type ReleaseFilter func(matchesSoFar int, currentVersion string) bool

func lastNReleases(max int) ReleaseFilter {
return func(matchesSoFar int, currentVersion string) bool {
return max < 1 || matchesSoFar < max
}
}
}

// filterReleasesByTrack only works reliably if iterating on Bazel versions in descending order.
Expand Down
2 changes: 1 addition & 1 deletion repositories/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (gcs *GCSRepo) removeCandidates(history []string, filter core.ReleaseFilter
filterPassed := false
// Iteration in descending order is important:
// - ReleaseFilter won't work correctly otherwise
// - It makes more sense in the "latest-n" use case
// - It makes more sense in the "latest-n" use case
for hpos := len(history) - 1; hpos >= 0; hpos-- {
latestVersion := history[hpos]
pass := filter(len(descendingReleases), latestVersion)
Expand Down

0 comments on commit c044e94

Please sign in to comment.