Skip to content

Commit

Permalink
internal/dl: highlight Windows ARM64 installer
Browse files Browse the repository at this point in the history
The windows/arm64 port is new to Go 1.17 and one of its key features.
Highlight the Windows ARM64 installer, just like the Windows AMD64
installer is highlighted. (Keep the zip archives and 386 installer
not highlighted.)

For golang/go#36439.

Change-Id: Ib57e80465d0ca090d165e14e3c4afdb2efca0c11
Reviewed-on: https://go-review.googlesource.com/c/website/+/344070
Trust: Dmitri Shuralyov <[email protected]>
Run-TryBot: Dmitri Shuralyov <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
  • Loading branch information
passionSeven committed Aug 23, 2021
1 parent 9b2133e commit 967883e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion internal/dl/dl.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (f File) Highlight() bool {
return true
case f.OS == "linux" && f.Arch == "amd64":
return true
case f.OS == "windows" && f.Kind == "installer" && f.Arch == "amd64":
case f.OS == "windows" && f.Kind == "installer" && (f.Arch == "amd64" || f.Arch == "arm64"):
return true
case f.OS == "darwin" && f.Kind == "installer" && !strings.Contains(f.Filename, "osx10.6"):
return true
Expand Down
35 changes: 19 additions & 16 deletions internal/dl/dl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,19 @@ func TestFilesToReleases(t *testing.T) {

func TestHighlightedFiles(t *testing.T) {
fs := []File{
{Filename: "go1.16beta1.src.tar.gz", Version: "go1.16beta1", OS: "", Arch: "", Kind: "source"},
{Filename: "go1.16beta1.linux-386.tar.gz", Version: "go1.16beta1", OS: "linux", Arch: "386", Kind: "archive"},
{Filename: "go1.16beta1.linux-amd64.tar.gz", Version: "go1.16beta1", OS: "linux", Arch: "amd64", Kind: "archive"},
{Filename: "go1.16beta1.darwin-amd64.tar.gz", Version: "go1.16beta1", OS: "darwin", Arch: "amd64", Kind: "archive"},
{Filename: "go1.16beta1.darwin-amd64.pkg", Version: "go1.16beta1", OS: "darwin", Arch: "amd64", Kind: "installer"},
{Filename: "go1.16beta1.darwin-arm64.tar.gz", Version: "go1.16beta1", OS: "darwin", Arch: "arm64", Kind: "archive"},
{Filename: "go1.16beta1.darwin-arm64.pkg", Version: "go1.16beta1", OS: "darwin", Arch: "arm64", Kind: "installer"},
{Filename: "go1.16beta1.windows-386.zip", Version: "go1.16beta1", OS: "windows", Arch: "386", Kind: "archive"},
{Filename: "go1.16beta1.windows-386.msi", Version: "go1.16beta1", OS: "windows", Arch: "386", Kind: "installer"},
{Filename: "go1.16beta1.windows-amd64.zip", Version: "go1.16beta1", OS: "windows", Arch: "amd64", Kind: "archive"},
{Filename: "go1.16beta1.windows-amd64.msi", Version: "go1.16beta1", OS: "windows", Arch: "amd64", Kind: "installer"},
{Filename: "go1.17.src.tar.gz", Version: "go1.17", OS: "", Arch: "", Kind: "source"},
{Filename: "go1.17.linux-386.tar.gz", Version: "go1.17", OS: "linux", Arch: "386", Kind: "archive"},
{Filename: "go1.17.linux-amd64.tar.gz", Version: "go1.17", OS: "linux", Arch: "amd64", Kind: "archive"},
{Filename: "go1.17.darwin-amd64.tar.gz", Version: "go1.17", OS: "darwin", Arch: "amd64", Kind: "archive"},
{Filename: "go1.17.darwin-amd64.pkg", Version: "go1.17", OS: "darwin", Arch: "amd64", Kind: "installer"},
{Filename: "go1.17.darwin-arm64.tar.gz", Version: "go1.17", OS: "darwin", Arch: "arm64", Kind: "archive"},
{Filename: "go1.17.darwin-arm64.pkg", Version: "go1.17", OS: "darwin", Arch: "arm64", Kind: "installer"},
{Filename: "go1.17.windows-386.zip", Version: "go1.17", OS: "windows", Arch: "386", Kind: "archive"},
{Filename: "go1.17.windows-386.msi", Version: "go1.17", OS: "windows", Arch: "386", Kind: "installer"},
{Filename: "go1.17.windows-amd64.zip", Version: "go1.17", OS: "windows", Arch: "amd64", Kind: "archive"},
{Filename: "go1.17.windows-amd64.msi", Version: "go1.17", OS: "windows", Arch: "amd64", Kind: "installer"},
{Filename: "go1.17.windows-arm64.zip", Version: "go1.17", OS: "windows", Arch: "arm64", Kind: "archive"},
{Filename: "go1.17.windows-arm64.msi", Version: "go1.17", OS: "windows", Arch: "arm64", Kind: "installer"},
}
sort.Sort(fileOrder(fs))
var highlighted []string
Expand All @@ -123,11 +125,12 @@ func TestHighlightedFiles(t *testing.T) {
}
got := strings.Join(highlighted, "\n")
want := strings.Join([]string{
"go1.16beta1.src.tar.gz",
"go1.16beta1.darwin-amd64.pkg",
"go1.16beta1.darwin-arm64.pkg",
"go1.16beta1.linux-amd64.tar.gz",
"go1.16beta1.windows-amd64.msi",
"go1.17.src.tar.gz",
"go1.17.darwin-amd64.pkg",
"go1.17.darwin-arm64.pkg",
"go1.17.linux-amd64.tar.gz",
"go1.17.windows-amd64.msi",
"go1.17.windows-arm64.msi",
}, "\n")
if got != want {
t.Errorf("highlighted files:\n%s\nwant:\n%s", got, want)
Expand Down

0 comments on commit 967883e

Please sign in to comment.