dashboard: limit macOS 10.12 builders to at most go1.16

macOS will not be supported after go1.16. This change limits the macOS
10.12 builders to build previous to go1.17.

Updates golang/go#44303
For golang/go#23011

Change-Id: Ib6b4e7939ffb9032b255574d3f0b4fffaad97803
Reviewed-on: https://go-review.googlesource.com/c/build/+/312692
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 45324bf..7bd3819 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -2302,6 +2302,10 @@
 		Name:           "darwin-amd64-10_12",
 		HostType:       "host-darwin-10_12",
 		distTestAdjust: macTestPolicy,
+		buildsRepo: func(repo, branch, goBranch string) bool {
+			// macOS 10.12 not supported after Go 1.16
+			return atMostGo1(goBranch, 16) && buildRepoByDefault(repo)
+		},
 	})
 	addBuilder(BuildConfig{
 		Name:           "darwin-amd64-10_14",
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index 2bd683c..dbb4a1d 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -547,11 +547,14 @@
 		{b("android-amd64-emu", "build"), none},
 
 		// Only use latest macOS for subrepos, and only amd64:
-		{b("darwin-amd64-10_12", "net"), onlyPost},
+		{b("darwin-amd64-10_12@go1.16", "net"), onlyPost},
+		{b("darwin-amd64-10_12", "net"), none},
+		{b("darwin-amd64-10_14", "net"), onlyPost},
 
 		{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_12", "go"), none},
+		{b("darwin-amd64-10_12@go1.16", "go"), onlyPost},
 
 		// plan9 only lived at master. We didn't support any past releases.
 		// But it's off for now as it's always failing.