godoc/static: link to golang.org for content moved out of Go root

More of the golang.org website content has moved from the Go tree to
the x/website repository in CL 291711, resulting in broken links or
otherwise missing resources in godoc. None of it is affecting godoc's
core functionality, but it's good to fix broken links, so link to the
resources served by golang.org for now.

If it becomes important to make these resources available while godoc
is running offline, that can be done later. (It will be easier once
we can start relying on //go:embed for all supported Go versions.)

Include a local copy of a favicon.ico since the one in Go root is no
longer there as of CL 300549.

For golang/go#32011.

Change-Id: If5bd8e61b72dd9ca1db469d9121e43742846c115
Reviewed-on: https://go-review.googlesource.com/c/tools/+/300394
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Dmitri Shuralyov 2021-03-10 11:37:02 -05:00
parent ca627f833c
commit 682c7e60bf
8 changed files with 16 additions and 11 deletions

View File

@ -192,8 +192,10 @@ func main() {
}
if *templateDir != "" {
fs.Bind("/lib/godoc", vfs.OS(*templateDir), "/", vfs.BindBefore)
fs.Bind("/favicon.ico", vfs.OS(*templateDir), "/favicon.ico", vfs.BindReplace)
} else {
fs.Bind("/lib/godoc", mapfs.New(static.Files), "/", vfs.BindReplace)
fs.Bind("/favicon.ico", mapfs.New(static.Files), "/favicon.ico", vfs.BindReplace)
}
// Get the GOMOD value, use it to determine if godoc is being invoked in module mode.

View File

@ -62,7 +62,7 @@
Clicking on the identifier that defines a named type causes a panel
to appear, displaying information about the named type, including
its size and alignment in bytes, its
<a href='http://golang.org/ref/spec#Method_sets'>method set</a>, and its
<a href='https://golang.org/ref/spec#Method_sets'>method set</a>, and its
<i>implements</i> relation: the set of types T that are assignable to
or from this type U where at least one of T or U is an interface.

BIN
godoc/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -35,6 +35,7 @@ var files = []string{
"dirlist.html",
"error.html",
"example.html",
"favicon.ico",
"godoc.html",
"godocs.js",
"images/minus.gif",

View File

@ -39,7 +39,7 @@
<form method="GET" action="/search">
<div id="menu">
{{if (and .Playground .Title)}}
<a id="playgroundButton" href="http://play.golang.org/" title="Show Go Playground">Play</a>
<a id="playgroundButton" href="https://play.golang.org/" title="Show Go Playground">Play</a>
{{end}}
<span class="search-box"><input type="search" id="search" name="q" placeholder="Search" aria-label="Search" required><button type="submit"><span><!-- magnifying glass: --><svg width="24" height="24" viewBox="0 0 24 24"><title>submit search</title><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/><path d="M0 0h24v24H0z" fill="none"/></svg></span></button></span>
</div>
@ -98,8 +98,8 @@ Except as <a href="https://developers.google.com/site-policies#restrictions">not
the content of this page is licensed under the
Creative Commons Attribution 3.0 License,
and code is licensed under a <a href="/LICENSE">BSD license</a>.<br>
<a href="/doc/tos.html">Terms of Service</a> |
<a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
<a href="https://golang.org/doc/tos.html">Terms of Service</a> |
<a href="https://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
</div>
</div><!-- .container -->

View File

@ -38,7 +38,7 @@
</div>
<div class="expanded">
<h2 class="toggleButton" title="Click to hide Standard library section">Standard library ▾</h2>
<img alt="" class="gopher" src="/doc/gopher/pkg.png"/>
<img alt="" class="gopher" src="https://golang.org/doc/gopher/pkg.png"/>
<div class="pkg-dir">
<table>
<tr>
@ -115,7 +115,7 @@
<h3 id="subrepo">Sub-repositories</h3>
<p>
These packages are part of the Go Project but outside the main Go tree.
They are developed under looser <a href="/doc/go1compat">compatibility requirements</a> than the Go core.
They are developed under looser <a href="https://golang.org/doc/go1compat">compatibility requirements</a> than the Go core.
Install them with "<a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a>".
</p>
<ul>

File diff suppressed because one or more lines are too long

View File

@ -404,7 +404,7 @@ div#about {
margin: 0 auto 1.875rem;
}
div#gopher {
background: url(/doc/gopher/frontpage.png) no-repeat;
background: url(https://golang.org/doc/gopher/frontpage.png) no-repeat;
background-position: center top;
height: 9.688rem;
max-height: 200px; /* Setting in px to prevent the gopher from blowing up in very high default font-sizes */