From c044e9471ed6a69bad1976dafa312200ae811d5e Mon Sep 17 00:00:00 2001 From: Florian Weikert Date: Tue, 6 Sep 2022 17:40:39 +0200 Subject: [PATCH] Fix minor style issues (#359) --- core/repositories.go | 3 ++- repositories/gcs.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/repositories.go b/core/repositories.go index 45bbbe99..f0ab7327 100644 --- a/core/repositories.go +++ b/core/repositories.go @@ -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. diff --git a/repositories/gcs.go b/repositories/gcs.go index 0d9c7a04..542e781d 100644 --- a/repositories/gcs.go +++ b/repositories/gcs.go @@ -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)