Skip to content

Commit

Permalink
godoc/static: link to golang.org for content moved out of Go root
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dmitshur committed Mar 30, 2021
1 parent ca627f8 commit 682c7e6
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
2 changes: 2 additions & 0 deletions cmd/godoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion godoc/static/analysis/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h3>Type information: size/alignment, method set, interfaces</h3>
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.

Expand Down
Binary file added godoc/static/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions godoc/static/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var files = []string{
"dirlist.html",
"error.html",
"example.html",
"favicon.ico",
"godoc.html",
"godocs.js",
"images/minus.gif",
Expand Down
6 changes: 3 additions & 3 deletions godoc/static/godoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -98,8 +98,8 @@ <h2>
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 -->
Expand Down
4 changes: 2 additions & 2 deletions godoc/static/packageroot.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h2 class="toggleButton" title="Click to show Standard library section">Standard
</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>
Expand Down Expand Up @@ -115,7 +115,7 @@ <h2 id="other">Other packages</h2>
<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>
Expand Down
10 changes: 6 additions & 4 deletions godoc/static/static.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion godoc/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 682c7e6

Please sign in to comment.