Refactor conditions

Co-authored-by: Andy Feller <andyfeller@github.com>
This commit is contained in:
Tim Rogers 2024-09-12 18:53:24 +01:00 committed by GitHub
parent a0a2567354
commit 5296d60832
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -267,14 +267,14 @@ func (m *Manager) installBin(repo ghrepo.Interface, target string) error {
if asset == nil && isMacARM {
for _, a := range r.Assets {
if strings.HasSuffix(a.Name, "darwin-amd64") {
if hasRosetta() {
asset = &a
break
} else {
if !hasRosetta() {
return fmt.Errorf(
"%[1]s unsupported for %[2]s. Install Rosetta with `softwareupdate --install-rosetta` to use the available darwin-amd64 binary, or open an issue: `gh issue create -R %[3]s/%[1]s -t'Support %[2]s'`",
repo.RepoName(), platform, repo.RepoOwner())
}
asset = &a
break
}
}
}