internal/task: update for golang.org → go.dev website move

Start using the new shorter go.dev domain name where applicable,
such as when making announcement tweets. The previous name will
always work too, but we want to be consistent and up to date in
our external communication.

Continue to use golang.org/dl when it refers to the module path
since that hasn't changed.

Change-Id: I897ae4cdfb0b4af396923691887e701b95b8f93b
Reviewed-on: https://go-review.googlesource.com/c/build/+/368975
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
diff --git a/internal/task/dlcl.go b/internal/task/dlcl.go
index 2f4d2b3..a4d8c50 100644
--- a/internal/task/dlcl.go
+++ b/internal/task/dlcl.go
@@ -29,7 +29,7 @@
 // 	• "go1.18beta1" or "go1.18rc1" for a pre-release
 //
 // Credentials are fetched from Secret Manager.
-// On success, the URL of the change is returned, like "https://golang.org/cl/123".
+// On success, the URL of the change is returned, like "https://go.dev/cl/123".
 func MailDLCL(ctx context.Context, versions []string) (changeURL string, _ error) {
 	if len(versions) < 1 || len(versions) > 2 {
 		return "", fmt.Errorf("got %d Go versions, want 1 or 2", len(versions))
@@ -52,7 +52,7 @@
 			Version             string // "go1.5.3rc2"
 			VersionNoPatch      string // "go1.5"
 			CapitalSpaceVersion string // "Go 1.5"
-			DocHost             string // "golang.org" or "tip.golang.org" for rc/beta
+			DocHost             string // "go.dev" or "tip.golang.org" for rc/beta
 		}{
 			Year:                time.Now().UTC().Year(),
 			Version:             ver,
@@ -93,7 +93,7 @@
 	if err != nil {
 		return "", err
 	}
-	return fmt.Sprintf("https://golang.org/cl/%d", ci.ChangeNumber), nil
+	return fmt.Sprintf("https://go.dev/cl/%d", ci.ChangeNumber), nil
 }
 
 func verifyGoVersions(versions ...string) error {
@@ -113,7 +113,7 @@
 	if strings.Contains(ver, "rc") || strings.Contains(ver, "beta") {
 		return "tip.golang.org"
 	}
-	return "golang.org"
+	return "go.dev"
 }
 
 func versionNoPatch(ver string) (string, error) {
@@ -123,7 +123,7 @@
 		return "", fmt.Errorf("unrecognized version %q", ver)
 	}
 	if m[2] != "" {
-		return "devel/release.html#" + m[1] + ".minor", nil
+		return "devel/release#" + m[1] + ".minor", nil
 	}
 	return m[1], nil
 }
@@ -142,9 +142,9 @@
 // And then use the {{.Version}} command as if it were your normal go
 // command.
 //
-// See the release notes at https://{{.DocHost}}/doc/{{.VersionNoPatch}}
+// See the release notes at https://{{.DocHost}}/doc/{{.VersionNoPatch}}.
 //
-// File bugs at https://golang.org/issues/new
+// File bugs at https://go.dev/issue/new.
 package main
 
 import "golang.org/dl/internal/version"
diff --git a/internal/task/tweet.go b/internal/task/tweet.go
index ea72826..8f04d50 100644
--- a/internal/task/tweet.go
+++ b/internal/task/tweet.go
@@ -246,7 +246,7 @@
 
 {{emoji "announce"}} Announcement: {{.Announcement}}
 
-{{emoji "download"}} Download: https://golang.org/dl/#{{.Version}}
+{{emoji "download"}} Download: https://go.dev/dl/#{{.Version}}
 
 #golang{{end}}
 
@@ -256,11 +256,11 @@
 
 {{with .Security}}{{emoji "security"}} Security: {{.}}{{"\n\n"}}{{end -}}
 
-{{emoji "try"}} Try it! File bugs! https://golang.org/issue/new
+{{emoji "try"}} Try it! File bugs! https://go.dev/issue/new
 
 {{emoji "announce"}} Announcement: {{.Announcement}}
 
-{{emoji "download"}} Download: https://golang.org/dl/#{{.Version}}
+{{emoji "download"}} Download: https://go.dev/dl/#{{.Version}}
 
 #golang{{end}}
 
@@ -270,11 +270,11 @@
 
 {{with .Security}}{{emoji "security"}} Security: {{.}}{{"\n\n"}}{{end -}}
 
-{{emoji "run"}} Run it in dev! Run it in prod! File bugs! https://golang.org/issue/new
+{{emoji "run"}} Run it in dev! Run it in prod! File bugs! https://go.dev/issue/new
 
 {{emoji "announce"}} Announcement: {{.Announcement}}
 
-{{emoji "download"}} Download: https://golang.org/dl/#{{.Version}}
+{{emoji "download"}} Download: https://go.dev/dl/#{{.Version}}
 
 #golang{{end}}
 
@@ -284,9 +284,9 @@
 
 {{with .Security}}{{emoji "security"}} Security: {{.}}{{"\n\n"}}{{end -}}
 
-{{emoji "notes"}} Release notes: https://golang.org/doc/{{.Version}}
+{{emoji "notes"}} Release notes: https://go.dev/doc/{{.Version}}
 
-{{emoji "download"}} Download: https://golang.org/dl/#{{.Version}}
+{{emoji "download"}} Download: https://go.dev/dl/#{{.Version}}
 
 #golang{{end}}`
 
@@ -359,7 +359,7 @@
 // tweet for goVersion. It returns the image encoded as PNG,
 // and the text displayed in the image.
 //
-// tweetImage makes an HTTP GET request to the golang.org/dl/?mode=json
+// tweetImage makes an HTTP GET request to the go.dev/dl/?mode=json
 // read-only API to select a random release archive to highlight.
 func tweetImage(goVersion string, rnd *rand.Rand) (imagePNG []byte, imageText string, _ error) {
 	a, err := fetchRandomArchive(goVersion, rnd)
@@ -423,7 +423,7 @@
 }
 
 func fetchReleaseArchives(goVer string) (archives []golangorgDLFile, _ error) {
-	url := "https://golang.org/dl/?mode=json"
+	url := "https://go.dev/dl/?mode=json"
 	if strings.Contains(goVer, "beta") || strings.Contains(goVer, "rc") ||
 		goVer == "go1.17" || goVer == "go1.17.1" /* For TestTweetRelease. */ {
 
@@ -464,13 +464,13 @@
 	return nil, fmt.Errorf("release version %q not found", goVer)
 }
 
-// golangorgDLRelease represents a release on the golang.org downloads page.
+// golangorgDLRelease represents a release on the go.dev downloads page.
 type golangorgDLRelease struct {
 	Version string
 	Files   []golangorgDLFile
 }
 
-// golangorgDLFile represents a file on the golang.org downloads page.
+// golangorgDLFile represents a file on the go.dev downloads page.
 // It should be kept in sync with code in x/build/cmd/release and x/website/internal/dl.
 type golangorgDLFile struct {
 	Filename string
@@ -570,7 +570,7 @@
 var (
 	// gopherBlue is the Gopher Blue primary color from the Go color palette.
 	//
-	// Reference: https://golang.org/s/brandbook.
+	// Reference: https://go.dev/s/brandbook.
 	gopherBlue = color.NRGBA{0, 173, 216, 255} // #00add8.
 
 	// terminalColor is the color used as the terminal color.
diff --git a/internal/task/tweet_test.go b/internal/task/tweet_test.go
index 590b2e0..68bbdf1 100644
--- a/internal/task/tweet_test.go
+++ b/internal/task/tweet_test.go
@@ -21,7 +21,7 @@
 		// This test is useful when modifying the tweet text and image templates,
 		// but don't run it in -short mode since tweetImage involves making some
 		// HTTP GET requests to the internet.
-		t.Skip("skipping test that hits golang.org/dl/?mode=json read-only API in -short mode")
+		t.Skip("skipping test that hits go.dev/dl/?mode=json read-only API in -short mode")
 	}
 
 	tests := [...]struct {
@@ -47,7 +47,7 @@
 
 📢 Announcement: https://groups.google.com/g/golang-announce/c/dx9d7IOseHw/m/KNH37k37AAAJ
 
-⬇️ Download: https://golang.org/dl/#go1.17.1
+⬇️ Download: https://go.dev/dl/#go1.17.1
 
 #golang
 tweet image:
@@ -72,11 +72,11 @@
 			wantLog: `tweet text:
 ⚡️ Go 1.17 Beta 1 is released!
 
-⚙️ Try it! File bugs! https://golang.org/issue/new
+⚙️ Try it! File bugs! https://go.dev/issue/new
 
 🗣 Announcement: https://groups.google.com/g/golang-announce/c/i4EliPDV9Ok/m/MxA-nj53AAAJ
 
-📦 Download: https://golang.org/dl/#go1.17beta1
+📦 Download: https://go.dev/dl/#go1.17beta1
 
 #golang
 tweet image:
@@ -101,11 +101,11 @@
 			wantLog: `tweet text:
 🎉 Go 1.17 Release Candidate 2 is released!
 
-🏖 Run it in dev! Run it in prod! File bugs! https://golang.org/issue/new
+🏖 Run it in dev! Run it in prod! File bugs! https://go.dev/issue/new
 
 🔈 Announcement: https://groups.google.com/g/golang-announce/c/yk30ovJGXWY/m/p9uUnKbbBQAJ
 
-📦 Download: https://golang.org/dl/#go1.17rc2
+📦 Download: https://go.dev/dl/#go1.17rc2
 
 #golang
 tweet image:
@@ -132,9 +132,9 @@
 
 🔐 Security: Includes a super duper security fix (CVE-123).
 
-📝 Release notes: https://golang.org/doc/go1.17
+📝 Release notes: https://go.dev/doc/go1.17
 
-📦 Download: https://golang.org/dl/#go1.17
+📦 Download: https://go.dev/dl/#go1.17
 
 #golang
 tweet image:
@@ -163,7 +163,7 @@
 				t.Errorf("unexpected tweetURL: got = %q, want %q", got, want)
 			}
 			if got, want := buf.String(), tc.wantLog; got != want {
-				t.Errorf("unexpected log: got = %q, want %q", got, want)
+				t.Errorf("unexpected log:\n got: %q\nwant: %q", got, want)
 			}
 		})
 	}