all: replace godoc.org links with pkg.go.dev
Change links from godoc.org to pkg.go.dev. For golang/go#36106 Change-Id: Ic3ec03efc265cdc332027d538b0c5d4d91bdac24 Reviewed-on: https://go-review.googlesource.com/c/website/+/275195 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Родитель
3718ed17ce
Коммит
9bb0e2307d
|
@ -26,7 +26,7 @@ func init() {
|
||||||
func xHandler(w http.ResponseWriter, r *http.Request) {
|
func xHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if !strings.HasPrefix(r.URL.Path, xPrefix) {
|
if !strings.HasPrefix(r.URL.Path, xPrefix) {
|
||||||
// Shouldn't happen if handler is registered correctly.
|
// Shouldn't happen if handler is registered correctly.
|
||||||
http.Redirect(w, r, "https://godoc.org/-/subrepo", http.StatusTemporaryRedirect)
|
http.Redirect(w, r, "https://pkg.go.dev/search?q=golang.org/x", http.StatusTemporaryRedirect)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
proj, suffix := strings.TrimPrefix(r.URL.Path, xPrefix), ""
|
proj, suffix := strings.TrimPrefix(r.URL.Path, xPrefix), ""
|
||||||
|
@ -34,7 +34,7 @@ func xHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
proj, suffix = proj[:i], proj[i:]
|
proj, suffix = proj[:i], proj[i:]
|
||||||
}
|
}
|
||||||
if proj == "" {
|
if proj == "" {
|
||||||
http.Redirect(w, r, "https://godoc.org/-/subrepo", http.StatusTemporaryRedirect)
|
http.Redirect(w, r, "https://pkg.go.dev/search?q=golang.org/x", http.StatusTemporaryRedirect)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
repo, ok := repos.ByGerritProject[proj]
|
repo, ok := repos.ByGerritProject[proj]
|
||||||
|
@ -42,15 +42,10 @@ func xHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
docSite := "godoc.org"
|
|
||||||
if repo.UsePkgGoDev() {
|
|
||||||
docSite = "pkg.go.dev"
|
|
||||||
}
|
|
||||||
data := struct {
|
data := struct {
|
||||||
DocSite string // Website providing documentation, either "godoc.org" or "pkg.go.dev".
|
|
||||||
Proj string // Gerrit project ("net", "sys", etc)
|
Proj string // Gerrit project ("net", "sys", etc)
|
||||||
Suffix string // optional "/path" for requests like /x/PROJ/path
|
Suffix string // optional "/path" for requests like /x/PROJ/path
|
||||||
}{docSite, proj, suffix}
|
}{proj, suffix}
|
||||||
if err := xTemplate.Execute(w, data); err != nil {
|
if err := xTemplate.Execute(w, data); err != nil {
|
||||||
log.Println("xHandler:", err)
|
log.Println("xHandler:", err)
|
||||||
}
|
}
|
||||||
|
@ -62,10 +57,10 @@ var xTemplate = template.Must(template.New("x").Parse(`<!DOCTYPE html>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
<meta name="go-import" content="golang.org/x/{{.Proj}} git https://go.googlesource.com/{{.Proj}}">
|
<meta name="go-import" content="golang.org/x/{{.Proj}} git https://go.googlesource.com/{{.Proj}}">
|
||||||
<meta name="go-source" content="golang.org/x/{{.Proj}} https://github.com/golang/{{.Proj}}/ https://github.com/golang/{{.Proj}}/tree/master{/dir} https://github.com/golang/{{.Proj}}/blob/master{/dir}/{file}#L{line}">
|
<meta name="go-source" content="golang.org/x/{{.Proj}} https://github.com/golang/{{.Proj}}/ https://github.com/golang/{{.Proj}}/tree/master{/dir} https://github.com/golang/{{.Proj}}/blob/master{/dir}/{file}#L{line}">
|
||||||
<meta http-equiv="refresh" content="0; url=https://{{.DocSite}}/golang.org/x/{{.Proj}}{{.Suffix}}">
|
<meta http-equiv="refresh" content="0; url=https://pkg.go.dev/golang.org/x/{{.Proj}}{{.Suffix}}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Nothing to see here; <a href="https://{{.DocSite}}/golang.org/x/{{.Proj}}{{.Suffix}}">move along</a>.
|
Nothing to see here; <a href="https://pkg.go.dev/golang.org/x/{{.Proj}}{{.Suffix}}">move along</a>.
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`))
|
`))
|
||||||
|
|
|
@ -48,7 +48,7 @@ func TestXHandler(t *testing.T) {
|
||||||
checks: []check{
|
checks: []check{
|
||||||
status(200),
|
status(200),
|
||||||
substr(`<meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">`),
|
substr(`<meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">`),
|
||||||
substr(`http-equiv="refresh" content="0; url=https://godoc.org/golang.org/x/net">`),
|
substr(`http-equiv="refresh" content="0; url=https://pkg.go.dev/golang.org/x/net">`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ func TestXHandler(t *testing.T) {
|
||||||
checks: []check{
|
checks: []check{
|
||||||
status(200),
|
status(200),
|
||||||
substr(`<meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">`),
|
substr(`<meta name="go-import" content="golang.org/x/net git https://go.googlesource.com/net">`),
|
||||||
substr(`http-equiv="refresh" content="0; url=https://godoc.org/golang.org/x/net/suffix">`),
|
substr(`http-equiv="refresh" content="0; url=https://pkg.go.dev/golang.org/x/net/suffix">`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ func TestXHandler(t *testing.T) {
|
||||||
path: "/x/",
|
path: "/x/",
|
||||||
checks: []check{
|
checks: []check{
|
||||||
status(307),
|
status(307),
|
||||||
hasHeader("Location", "https://godoc.org/-/subrepo"),
|
hasHeader("Location", "https://pkg.go.dev/search?q=golang.org/x"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,7 +100,7 @@ The tree above shows a workspace containing two repositories
|
||||||
The <code>example</code> repository contains two commands (<code>hello</code>
|
The <code>example</code> repository contains two commands (<code>hello</code>
|
||||||
and <code>outyet</code>) and one library (<code>stringutil</code>).
|
and <code>outyet</code>) and one library (<code>stringutil</code>).
|
||||||
The <code>image</code> repository contains the <code>bmp</code> package
|
The <code>image</code> repository contains the <code>bmp</code> package
|
||||||
and <a href="https://godoc.org/golang.org/x/image">several others</a>.
|
and <a href="https://pkg.go.dev/golang.org/x/image">several others</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -595,8 +595,8 @@ import "github.com/golang/example/stringutil"
|
||||||
<p>
|
<p>
|
||||||
This convention is the easiest way to make your Go packages available for
|
This convention is the easiest way to make your Go packages available for
|
||||||
others to use.
|
others to use.
|
||||||
The <a href="//golang.org/wiki/Projects">Go Wiki</a>
|
<a href="//pkg.go.dev">Pkg.go.dev</a>
|
||||||
and <a href="//godoc.org/">godoc.org</a>
|
and the <a href="//golang.org/wiki/Projects">Go Wiki</a>
|
||||||
provide lists of external Go projects.
|
provide lists of external Go projects.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -119,24 +119,24 @@
|
||||||
Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>".
|
Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>".
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="//godoc.org/golang.org/x/benchmarks">benchmarks</a> — benchmarks to measure Go as it is developed.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/benchmarks">benchmarks</a> — benchmarks to measure Go as it is developed.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/blog">blog</a> — <a href="//blog.golang.org">blog.golang.org</a>'s implementation.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/blog">blog</a> — <a href="//blog.golang.org">blog.golang.org</a>'s implementation.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/build">build</a> — <a href="//build.golang.org">build.golang.org</a>'s implementation.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/build">build</a> — <a href="//build.golang.org">build.golang.org</a>'s implementation.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/crypto">crypto</a> — additional cryptography packages.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/crypto">crypto</a> — additional cryptography packages.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/debug">debug</a> — an experimental debugger for Go.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/debug">debug</a> — an experimental debugger for Go.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/image">image</a> — additional imaging packages.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/image">image</a> — additional imaging packages.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/mobile">mobile</a> — experimental support for Go on mobile platforms.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/mobile">mobile</a> — experimental support for Go on mobile platforms.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/net">net</a> — additional networking packages.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/net">net</a> — additional networking packages.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/perf">perf</a> — packages and tools for performance measurement, storage, and analysis.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/perf">perf</a> — packages and tools for performance measurement, storage, and analysis.</li>
|
||||||
<li><a href="//pkg.go.dev/golang.org/x/pkgsite">pkgsite</a> — home of the pkg.go.dev website.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/pkgsite">pkgsite</a> — home of the pkg.go.dev website.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/review">review</a> — a tool for working with Gerrit code reviews.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/review">review</a> — a tool for working with Gerrit code reviews.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/sync">sync</a> — additional concurrency primitives.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/sync">sync</a> — additional concurrency primitives.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/sys">sys</a> — packages for making system calls.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/sys">sys</a> — packages for making system calls.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/text">text</a> — packages for working with text.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/text">text</a> — packages for working with text.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/time">time</a> — additional time packages.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/time">time</a> — additional time packages.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/tools">tools</a> — godoc, goimports, gorename, and other tools.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/tools">tools</a> — godoc, goimports, gorename, and other tools.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/tour">tour</a> — <a href="//tour.golang.org">tour.golang.org</a>'s implementation.</li>
|
<li><a href="//pkg.go.dev/golang.org/x/tour">tour</a> — <a href="//tour.golang.org">tour.golang.org</a>'s implementation.</li>
|
||||||
<li><a href="//godoc.org/golang.org/x/exp">exp</a> — experimental and deprecated packages (handle with care; may change without warning).</li>
|
<li><a href="//pkg.go.dev/golang.org/x/exp">exp</a> — experimental and deprecated packages (handle with care; may change without warning).</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3 id="community">Community</h3>
|
<h3 id="community">Community</h3>
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
These services can help you find Open Source packages provided by the community.
|
These services can help you find Open Source packages provided by the community.
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="//godoc.org">GoDoc</a> - a package index and search engine.</li>
|
<li><a href="//pkg.go.dev">Pkg.go.dev</a> - the Go package discovery site.</li>
|
||||||
<li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
|
<li><a href="/wiki/Projects">Projects at the Go Wiki</a> - a curated list of Go projects.</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -209,7 +209,7 @@ func (h server) getHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, downloadBaseURL+name, http.StatusFound)
|
http.Redirect(w, r, downloadBaseURL+name, http.StatusFound)
|
||||||
return
|
return
|
||||||
case name == "gotip":
|
case name == "gotip":
|
||||||
redirectURL = "https://godoc.org/golang.org/dl/gotip"
|
redirectURL = "https://pkg.go.dev/golang.org/dl/gotip"
|
||||||
case goGetRe.MatchString(name):
|
case goGetRe.MatchString(name):
|
||||||
redirectURL = "https://golang.org/dl/#" + name
|
redirectURL = "https://golang.org/dl/#" + name
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -99,7 +99,7 @@ var redirects = map[string]string{
|
||||||
"/build": "http://build.golang.org",
|
"/build": "http://build.golang.org",
|
||||||
"/change": "https://go.googlesource.com/go",
|
"/change": "https://go.googlesource.com/go",
|
||||||
"/cl": "https://go-review.googlesource.com",
|
"/cl": "https://go-review.googlesource.com",
|
||||||
"/cmd/godoc/": "http://godoc.org/golang.org/x/tools/cmd/godoc/",
|
"/cmd/godoc/": "https://pkg.go.dev/golang.org/x/tools/cmd/godoc",
|
||||||
"/issue": "https://github.com/golang/go/issues",
|
"/issue": "https://github.com/golang/go/issues",
|
||||||
"/issue/new": "https://github.com/golang/go/issues/new",
|
"/issue/new": "https://github.com/golang/go/issues/new",
|
||||||
"/issues": "https://github.com/golang/go/issues",
|
"/issues": "https://github.com/golang/go/issues",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче