cmd/release: update the releaselets for go1.18

This change updates the builders used for go1.18 by:
- Using FreeBSD 12.2

It also removes unused releaselets (Go version < 1.16).

Updates golang/go#40561

Change-Id: I3f46d197e9d235cf4577a1687848f8b52981c5e3
Reviewed-on: https://go-review.googlesource.com/c/build/+/365694
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/cmd/release/release.go b/cmd/release/release.go
index e26ea9b..eca253b 100644
--- a/cmd/release/release.go
+++ b/cmd/release/release.go
@@ -152,7 +152,6 @@
 		Builder: "linux-amd64",
 	},
 	{
-		GoQuery: ">= go1.16beta1",
 		OS:      "linux",
 		Arch:    "386",
 		Builder: "linux-386-stretch",
@@ -164,26 +163,37 @@
 		Goarm:   6, // For compatibility with all Raspberry Pi models.
 	},
 	{
-		GoQuery: ">= go1.16beta1",
 		OS:      "linux",
 		Arch:    "amd64",
 		Race:    true,
 		Builder: "linux-amd64-stretch", // Using Stretch as of Go 1.16 because Jessie LTS has ended (golang.org/issue/40561#issuecomment-731482962).
 	},
 	{
-		GoQuery: ">= go1.16beta1",
 		OS:      "linux",
 		Arch:    "arm64",
 		Builder: "linux-arm64-aws",
 	},
 	{
-		GoQuery: ">= go1.17beta1", // See #45727.
+		GoQuery: ">= go1.18beta1", // See #40561.
+		OS:      "freebsd",
+		Arch:    "386",
+		Builder: "freebsd-386-12_2",
+	},
+	{
+		GoQuery: ">= go1.18beta1", // See #40561.
+		OS:      "freebsd",
+		Arch:    "amd64",
+		Race:    true,
+		Builder: "freebsd-amd64-12_2",
+	},
+	{
+		GoQuery: ">= go1.17beta1 && < go1.18beta1", // See #45727.
 		OS:      "freebsd",
 		Arch:    "386",
 		Builder: "freebsd-386-11_4",
 	},
 	{
-		GoQuery: ">= go1.17beta1", // See #45727.
+		GoQuery: ">= go1.17beta1 && < go1.18beta1", // See #45727.
 		OS:      "freebsd",
 		Arch:    "amd64",
 		Race:    true,
@@ -215,7 +225,6 @@
 		Builder: "darwin-amd64-11_0",
 	},
 	{
-		GoQuery: ">= go1.16beta1", // Go 1.16 Beta 1 is the first Go (pre-)release with the darwin/arm64 port.
 		OS:      "darwin",
 		Arch:    "arm64",
 		Race:    true,
@@ -240,25 +249,6 @@
 
 	// Older builds.
 	{
-		GoQuery: "< go1.16beta1",
-		OS:      "linux",
-		Arch:    "386",
-		Builder: "linux-386-jessie",
-	},
-	{
-		GoQuery: "< go1.16beta1",
-		OS:      "linux",
-		Arch:    "amd64",
-		Race:    true,
-		Builder: "linux-amd64-jessie", // Using Jessie for Go 1.11 through Go 1.15 inclusive due to golang.org/issue/31293.
-	},
-	{
-		GoQuery: "< go1.16beta1",
-		OS:      "linux",
-		Arch:    "arm64",
-		Builder: "linux-arm64-packet",
-	},
-	{
 		GoQuery: "< go1.17beta1", // See #40563.
 		OS:      "freebsd",
 		Arch:    "386",
@@ -1026,9 +1016,9 @@
 	// TODO(amedee,dmitshur,golang.org/issue/40558): Use a version package to compare versions of Go.
 
 	// The minimum supported version of macOS with each version of go:
-	// go1.15 - macOS 10.12
 	// go1.16 - macOS 10.12
 	// go1.17 - macOS 10.13
+	// go1.18 - macOS 10.13
 	minMacVersion := "10.13"
 	if match("< go1.17beta1", goVer) {
 		minMacVersion = "10.12"
@@ -1045,14 +1035,16 @@
 	switch query {
 	case "": // A special case to make the zero Build.GoQuery value useful.
 		return true
+	case ">= go1.18beta1":
+		return !strings.HasPrefix(goVer, "go1.17") && !strings.HasPrefix(goVer, "go1.16")
+	case "< go1.18beta1":
+		return strings.HasPrefix(goVer, "go1.17") || strings.HasPrefix(goVer, "go1.16")
 	case ">= go1.17beta1":
-		return !strings.HasPrefix(goVer, "go1.16") && !strings.HasPrefix(goVer, "go1.15")
+		return !strings.HasPrefix(goVer, "go1.16")
 	case "< go1.17beta1":
-		return strings.HasPrefix(goVer, "go1.16") || strings.HasPrefix(goVer, "go1.15")
-	case ">= go1.16beta1":
-		return !strings.HasPrefix(goVer, "go1.15")
-	case "< go1.16beta1":
-		return strings.HasPrefix(goVer, "go1.15")
+		return strings.HasPrefix(goVer, "go1.16")
+	case ">= go1.17beta1 && < go1.18beta1":
+		return strings.HasPrefix(goVer, "go1.17")
 	default:
 		panic(fmt.Errorf("match: query %q is not supported", query))
 	}
diff --git a/cmd/release/release_test.go b/cmd/release/release_test.go
index 7b31b40..891481a 100644
--- a/cmd/release/release_test.go
+++ b/cmd/release/release_test.go
@@ -45,8 +45,6 @@
 		goVer     string
 		wantMacOS string
 	}{
-		{"go1.15", "10.12"},
-		{"go1.15.7", "10.12"},
 		{"go1.16beta1", "10.12"},
 		{"go1.16rc1", "10.12"},
 		{"go1.16", "10.12"},
@@ -55,6 +53,10 @@
 		{"go1.17rc1", "10.13"},
 		{"go1.17", "10.13"},
 		{"go1.17.2", "10.13"},
+		{"go1.18beta1", "10.13"},
+		{"go1.18rc1", "10.13"},
+		{"go1.18", "10.13"},
+		{"go1.18.2", "10.13"},
 	}
 	for _, tc := range testCases {
 		t.Run(tc.goVer, func(t *testing.T) {
@@ -82,35 +84,57 @@
 		target      string
 		wantBuilder string
 	}{
-		// Go 1.15.x still uses the Jessie builders.
-		{"go1.15.55", "linux-386", "linux-386-jessie"},
-		// Go 1.16 starts to use the the Stretch builders.
+		// linux
+		// Go 1.16 use the the Stretch builders.
 		{"go1.16", "linux-amd64", "linux-amd64-stretch"},
 		{"go1.16", "linux-386", "linux-386-stretch"},
+		// Go 1.17 use the the Stretch builders.
+		{"go1.17", "linux-amd64", "linux-amd64-stretch"},
+		{"go1.17", "linux-386", "linux-386-stretch"},
+		// Go 1.18 use the the Stretch builders.
+		{"go1.18", "linux-amd64", "linux-amd64-stretch"},
+		{"go1.18", "linux-386", "linux-386-stretch"},
 
-		// Go 1.16 and Go 1.15.14 start to use the the AWS builders.
-		{"go1.15.55", "linux-armv6l", "linux-arm-aws"}, // used as of golang.org/issue/45066
+		// linux-arm
 		{"go1.16", "linux-arm64", "linux-arm64-aws"},
 		{"go1.16", "linux-armv6l", "linux-arm-aws"},
+		{"go1.17", "linux-arm64", "linux-arm64-aws"},
+		{"go1.17", "linux-armv6l", "linux-arm-aws"},
+		{"go1.18", "linux-arm64", "linux-arm64-aws"},
+		{"go1.18", "linux-armv6l", "linux-arm-aws"},
 
-		// Go 1.15 RC 2+ starts to use the the FreeBSD 11.2 builder.
-		{"go1.15rc2", "freebsd-amd64", "freebsd-amd64-11_2"},
-		{"go1.15rc2", "freebsd-386", "freebsd-386-11_2"},
-		{"go1.15", "freebsd-amd64", "freebsd-amd64-11_2"},
-		{"go1.15", "freebsd-386", "freebsd-386-11_2"},
-		{"go1.15.1", "freebsd-amd64", "freebsd-amd64-11_2"},
-		{"go1.15.1", "freebsd-386", "freebsd-386-11_2"},
-		// Go 1.16 continues to use the the FreeBSD 11.2 builder.
+		// FreeBSD
+		{"go1.16rc2", "freebsd-amd64", "freebsd-amd64-11_2"},
+		{"go1.16rc2", "freebsd-386", "freebsd-386-11_2"},
 		{"go1.16", "freebsd-amd64", "freebsd-amd64-11_2"},
 		{"go1.16", "freebsd-386", "freebsd-386-11_2"},
-		// Go 1.16 uses MacOS 10.15.
-		{"go1.16", "darwin-amd64", "darwin-amd64-10_15"},
-
-		// Go 1.17 starts to use the FreeBSD 11.4 builder.
+		{"go1.16.1", "freebsd-amd64", "freebsd-amd64-11_2"},
+		{"go1.16.1", "freebsd-386", "freebsd-386-11_2"},
+		// Go 1.17 continues to use the the FreeBSD 11.4 builder.
+		{"go1.17rc2", "freebsd-amd64", "freebsd-amd64-11_4"},
+		{"go1.17rc2", "freebsd-386", "freebsd-386-11_4"},
 		{"go1.17", "freebsd-amd64", "freebsd-amd64-11_4"},
 		{"go1.17", "freebsd-386", "freebsd-386-11_4"},
+		// Go 1.18 use the the FreeBSD 12.2 builder.
+		{"go1.18", "freebsd-amd64", "freebsd-amd64-12_2"},
+		{"go1.18", "freebsd-386", "freebsd-386-12_2"},
+
+		// macOS
+		// Go 1.16 uses MacOS 10.15.
+		{"go1.16", "darwin-amd64", "darwin-amd64-10_15"},
 		// Go 1.17 uses MacOS 11.0.
 		{"go1.17", "darwin-amd64", "darwin-amd64-11_0"},
+		// Go 1.18 uses MacOS 11.0.
+		{"go1.18", "darwin-amd64", "darwin-amd64-11_0"},
+
+		// Windows
+		// Go 1.16 & 1.17 & 1.18 use Windows 2008.
+		{"go1.16", "windows-386", "windows-386-2008"},
+		{"go1.16", "windows-amd64", "windows-amd64-2008"},
+		{"go1.17", "windows-386", "windows-386-2008"},
+		{"go1.17", "windows-amd64", "windows-amd64-2008"},
+		{"go1.18", "windows-386", "windows-386-2008"},
+		{"go1.18", "windows-amd64", "windows-amd64-2008"},
 	}
 	for _, tc := range testCases {
 		t.Run(tc.target+"@"+tc.goVer, func(t *testing.T) {