app/appengine: sort subrepo tables by date: master, Go 1.12, Go 1.11
It was previously master, Go 1.11, then Go 1.12, which puts Go 1.11 in
the middle of two things that came after it.
Change-Id: I5c67bff7f0ab4269f1db3d4c7e8197df36dc12cb
Reviewed-on: https://go-review.googlesource.com/c/build/+/170779
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/app/appengine/ui.go b/app/appengine/ui.go
index c0207df..9aa8a50 100644
--- a/app/appengine/ui.go
+++ b/app/appengine/ui.go
@@ -140,6 +140,25 @@
tagState = append(tagState, s)
}
}
+ // Sort tagState in reverse lexical order by name so higher
+ // numbered release branches show first for subrepos
+ // https://build.golang.org/ after master. We want the subrepo
+ // order to be "master, release-branch.go1.12,
+ // release-branch.go1.11" so they're in order by date (newest
+ // first). If we weren't already at two digit minor versions we'd
+ // need to parse the branch name, but we can be lazy now
+ // and just do a string compare.
+ sort.Slice(tagState, func(i, j int) bool { // is item 'i' less than item 'j'?
+ ni, nj := tagState[i].Name, tagState[j].Name
+ switch {
+ case ni == "master":
+ return true // an i of "master" is always first
+ case nj == "master":
+ return false // if i wasn't "master", it can't be less than j's "master"
+ default:
+ return ni > nj // "release-branch.go1.12" > "release-branch.go1.11", so 1.12 sorts earlier
+ }
+ })
BuildData:
p := &Pagination{}