зеркало из https://github.com/golang/build.git
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>
This commit is contained in:
Родитель
8d2424ca4a
Коммит
dec3b03682
|
@ -29,7 +29,7 @@ import (
|
|||
// • "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 @@ func MailDLCL(ctx context.Context, versions []string) (changeURL string, _ error
|
|||
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 @@ func MailDLCL(ctx context.Context, versions []string) (changeURL string, _ error
|
|||
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 @@ func docHost(ver string) string {
|
|||
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 @@ func versionNoPatch(ver string) (string, error) {
|
|||
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 @@ var dlTmpl = template.Must(template.New("").Parse(`// Copyright {{.Year}} The Go
|
|||
// 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"
|
||||
|
|
|
@ -246,7 +246,7 @@ const tweetTextTmpl = `{{define "minor" -}}
|
|||
|
||||
{{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 @@ const tweetTextTmpl = `{{define "minor" -}}
|
|||
|
||||
{{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 @@ const tweetTextTmpl = `{{define "minor" -}}
|
|||
|
||||
{{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 @@ const tweetTextTmpl = `{{define "minor" -}}
|
|||
|
||||
{{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 @@ var emoji = map[string][]string{
|
|||
// 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 fetchRandomArchive(goVer string, rnd *rand.Rand) (archive golangorgDLFile,
|
|||
}
|
||||
|
||||
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 @@ func fetchReleaseArchives(goVer string) (archives []golangorgDLFile, _ error) {
|
|||
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 @@ func circle(x, y, r int) color.Alpha16 {
|
|||
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.
|
||||
|
|
|
@ -21,7 +21,7 @@ func TestTweetRelease(t *testing.T) {
|
|||
// 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 @@ func TestTweetRelease(t *testing.T) {
|
|||
|
||||
📢 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 @@ go version go1.17.1 linux/arm64` + "\n",
|
|||
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 @@ go version go1.17beta1 darwin/amd64` + "\n",
|
|||
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 @@ go version go1.17rc2 windows/arm64` + "\n",
|
|||
|
||||
🔐 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 @@ go version go1.17 freebsd/amd64` + "\n",
|
|||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче