diff --git a/platforms/platforms.go b/platforms/platforms.go index 14efc077..e14deea4 100644 --- a/platforms/platforms.go +++ b/platforms/platforms.go @@ -11,7 +11,12 @@ var platforms = map[string]string{"darwin": "macos", "linux": "ubuntu1404", "win // GetPlatform returns a Bazel CI-compatible platform identifier for the current operating system. // TODO(fweikert): raise an error for unsupported platforms func GetPlatform() string { - return platforms[runtime.GOOS] + platform := platforms[runtime.GOOS] + arch := runtime.GOARCH + if platform == "macos" && arch == "arm64" { + platform = "macos_arm64" + } + return platform } // DetermineExecutableFilenameSuffix returns the extension for binaries on the current operating system. diff --git a/repositories/gcs.go b/repositories/gcs.go index e06e9a93..82e33ddc 100644 --- a/repositories/gcs.go +++ b/repositories/gcs.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "log" - "runtime" "strings" "github.com/bazelbuild/bazelisk/httputil" @@ -237,11 +236,6 @@ func (gcs *GCSRepo) GetLastGreenCommit(bazeliskHome string, downstreamGreen bool // DownloadAtCommit downloads a Bazel binary built at the given commit into the specified location and returns the absolute path. func (gcs *GCSRepo) DownloadAtCommit(commit, destDir, destFile string) (string, error) { log.Printf("Using unreleased version at commit %s", commit) - platform := platforms.GetPlatform() - arch := runtime.GOARCH - if platform == "macos" && arch == "arm64" { - platform = "macos_arm64" - } - url := fmt.Sprintf("%s/%s/%s/bazel", nonCandidateBaseURL, platform, commit) + url := fmt.Sprintf("%s/%s/%s/bazel", nonCandidateBaseURL, platforms.GetPlatform(), commit) return httputil.DownloadBinary(url, destDir, destFile) }