dashboard: disable darwin-amd64-10_11 builder on Go 1.15+

Go 1.15 will require macOS 10.12 and newer¹, so keep the OS X 10.11
builder enabled only on release branches for 1.14 and older.

¹ https://golang.org/doc/go1.14#darwin

Fixes golang/go#37425

Change-Id: I89ab0eb56729fe16fb3a524c8f7b9bb25751d708
Reviewed-on: https://go-review.googlesource.com/c/build/+/222797
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 39a16a7..55a6db6 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -2026,10 +2026,14 @@
 		},
 	})
 	addBuilder(BuildConfig{
-		Name:              "darwin-amd64-10_11",
-		HostType:          "host-darwin-10_11",
-		tryBot:            nil, // disabled until Macs fixed; https://golang.org/issue/23859
-		buildsRepo:        onlyGo,
+		Name:     "darwin-amd64-10_11",
+		HostType: "host-darwin-10_11",
+		tryBot:   nil, // disabled until Macs fixed; https://golang.org/issue/23859
+		buildsRepo: func(repo, branch, goBranch string) bool {
+			// Go 1.14 is the last release that will run on macOS 10.11 El Capitan.
+			// (See https://golang.org/doc/go1.14#darwin.)
+			return repo == "go" && atMostGo1(branch, 14)
+		},
 		shouldRunDistTest: macTestPolicy,
 		numTryTestHelpers: 3,
 	})
@@ -2505,6 +2509,13 @@
 	return ok && major == 1 && minor >= min
 }
 
+// atMostGo1 reports whether branch is "release-branch.go1.N" where N <= max.
+// It assumes "master" branch is already greater than max, and doesn't include it.
+func atMostGo1(branch string, max int) bool {
+	major, minor, ok := version.ParseReleaseBranch(branch)
+	return ok && major == 1 && minor <= max
+}
+
 // onlyGo is a common buildsRepo policy value that only builds the main "go" repo.
 func onlyGo(repo, branch, goBranch string) bool { return repo == "go" }
 
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index 39e0339..5685708 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -522,7 +522,9 @@
 		{b("darwin-amd64-10_15", "go"), onlyPost},
 		{b("darwin-amd64-10_14", "go"), onlyPost},
 		{b("darwin-amd64-10_12", "go"), onlyPost},
-		{b("darwin-amd64-10_11", "go"), onlyPost},
+		{b("darwin-amd64-10_11", "go"), none},
+		{b("darwin-amd64-10_11@go1.14", "go"), onlyPost}, // Go 1.14 is the last release that will run on macOS 10.11 El Capitan.
+		{b("darwin-amd64-10_11@go1.15", "go"), none},     // Go 1.15 will require macOS 10.12 Sierra or later.
 		{b("darwin-386-10_14", "go"), onlyPost},
 		{b("darwin-386-10_14@go1.12", "go"), none},
 		{b("darwin-386-10_14@go1.13", "go"), onlyPost},