dashboard: add linux-amd64-goamd64v3 builder

The purpose of this builder will be to test Go with a non-default
value of the new GOAMD64 environment variable.

For golang/go#48505.
Updates golang/go#45453.

Change-Id: Ic7bf0bd45f3539530ac6540cc3609f87cfdab6f7
Reviewed-on: https://go-review.googlesource.com/c/build/+/386116
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Rakoczy <alex@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 3435592..9de74c4 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -762,7 +762,7 @@
 	// GCE options, if VMImage != "" || ContainerImage != ""
 	machineType    string // optional GCE instance type
 	RegularDisk    bool   // if true, use spinning disk instead of SSD
-	MinCPUPlatform string // optional; https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform
+	MinCPUPlatform string // optional. e2 instances are not supported. see https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
 
 	// EC2 options
 	isEC2 bool // if true, the instance is configured to run on EC2
@@ -1751,6 +1751,31 @@
 		numTryTestHelpers: 4,
 	})
 	addBuilder(BuildConfig{
+		Name:     "linux-amd64-goamd64v3",
+		HostType: "host-linux-bullseye",
+		Notes:    "builder with GOAMD64=v3, see proposal 45453 and issue 48505",
+		buildsRepo: func(repo, branch, goBranch string) bool {
+			// GOAMD64 is added in Go 1.18.
+			return atLeastGo1(goBranch, 18) && buildRepoByDefault(repo)
+		},
+		env: []string{
+			"GO_DISABLE_OUTBOUND_NETWORK=1",
+			"GOAMD64=v3",
+		},
+		// TODO(go.dev/issue/48505): The default cost-optimized E2 machine family
+		// selects one of Intel or AMD platforms at VM creation time. See if that
+		// can be sufficient, and possibly deemed better for purposes of testing
+		// GOAMD64=v3 on a wider set of of platforms.
+		//
+		// See https://cloud.google.com/compute/docs/machine-types#machine_types
+		// and https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform.
+		//
+		// Otherwise, we can consider something like this in the host:
+		//machineType:    "n2-standard-4", // e2 instances do not support MinCPUPlatform or NestedVirt.
+		//MinCPUPlatform: "Intel Haswell", // Haswell is minimum to meet x86-64-v3 level.
+		KnownIssue: 48505,
+	})
+	addBuilder(BuildConfig{
 		Name:                "linux-amd64-racecompile",
 		HostType:            "host-linux-bullseye",
 		tryBot:              nil, // TODO: add a func to conditionally run this trybot if compiler dirs are touched