internal/dl: use /dl/{file} URLs on /dl/ HTML page

The /dl/{file} URLs have been supported for many years but not well
documented. Start using them on the /dl/ HTML page and document them,
so that it is clear that they can be reliably used in scripts or so.

This causes clients to have to make an extra HTTP request (which gets
redirected to the target location serving the file bytes), but compared
to the total work to download a Go file, this is negligible. Clients
that really want to skip the redirect can do so, but the trade-off is
that they need to update the URL if the CDN used for Go file downloads
happens to change. The /dl/{file} links are not expected to change for
Go 1.

Fixes golang/go#38713.

Change-Id: I9df7d5b761baa6fa657c5dd2063c97b9b457367c
Reviewed-on: https://go-review.googlesource.com/c/website/+/238517
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
diff --git a/cmd/golangorg/regtest_test.go b/cmd/golangorg/regtest_test.go
index e235990..84e83a5 100644
--- a/cmd/golangorg/regtest_test.go
+++ b/cmd/golangorg/regtest_test.go
@@ -74,7 +74,7 @@
 		},
 		{
 			Path:      "/dl/",
-			Substring: "go1.11.windows-amd64.msi",
+			Substring: `href="/dl/go1.11.windows-amd64.msi"`,
 			Message:   "missing data on dl page - misconfiguration of datastore?",
 		},
 		{
diff --git a/content/static/godocs.js b/content/static/godocs.js
index 149f768..68e2a89 100644
--- a/content/static/godocs.js
+++ b/content/static/godocs.js
@@ -277,7 +277,7 @@
       $('.testWindows').show();
     }
 
-    var download = 'https://dl.google.com/go/' + filename;
+    var download = '/dl/' + filename;
 
     var message = $(
       '<p class="downloading">' +
diff --git a/content/static/static.go b/content/static/static.go
index 8216ae7..482fd75 100644
--- a/content/static/static.go
+++ b/content/static/static.go
@@ -83,7 +83,7 @@
 
 	"godoc.html": "<!DOCTYPE\x20html>\x0a<html\x20lang=\"en\">\x0a<meta\x20charset=\"utf-8\">\x0a<meta\x20name=\"description\"\x20content=\"Go\x20is\x20an\x20open\x20source\x20programming\x20language\x20that\x20makes\x20it\x20easy\x20to\x20build\x20simple,\x20reliable,\x20and\x20efficient\x20software.\">\x0a<meta\x20name=\"viewport\"\x20content=\"width=device-width,\x20initial-scale=1\">\x0a<meta\x20name=\"theme-color\"\x20content=\"#00ADD8\">\x0a{{with\x20.Tabtitle}}\x0a\x20\x20<title>{{html\x20.}}\x20-\x20The\x20Go\x20Programming\x20Language</title>\x0a{{else}}\x0a\x20\x20<title>The\x20Go\x20Programming\x20Language</title>\x0a{{end}}\x0a<link\x20href=\"https://fonts.googleapis.com/css?family=Work+Sans:600|Roboto:400,700\"\x20rel=\"stylesheet\">\x0a<link\x20href=\"https://fonts.googleapis.com/css?family=Product+Sans&text=Supported%20by%20Google&display=swap\"\x20rel=\"stylesheet\">\x0a<link\x20type=\"text/css\"\x20rel=\"stylesheet\"\x20href=\"/lib/godoc/style.css\">\x0a{{if\x20.SearchBox}}\x0a<link\x20rel=\"search\"\x20type=\"application/opensearchdescription+xml\"\x20title=\"godoc\"\x20href=\"/opensearch.xml\"\x20/>\x0a{{end}}\x0a<script>window.initFuncs\x20=\x20[];</script>\x0a{{with\x20.GoogleAnalytics}}\x0a<script>\x0avar\x20_gaq\x20=\x20_gaq\x20||\x20[];\x0a_gaq.push([\"_setAccount\",\x20\"{{.}}\"]);\x0awindow.trackPageview\x20=\x20function()\x20{\x0a\x20\x20_gaq.push([\"_trackPageview\",\x20location.pathname+location.hash]);\x0a};\x0awindow.trackPageview();\x0awindow.trackEvent\x20=\x20function(category,\x20action,\x20opt_label,\x20opt_value,\x20opt_noninteraction)\x20{\x0a\x20\x20_gaq.push([\"_trackEvent\",\x20category,\x20action,\x20opt_label,\x20opt_value,\x20opt_noninteraction]);\x0a};\x0a</script>\x0a{{end}}\x0a<script\x20src=\"/lib/godoc/jquery.js\"\x20defer></script>\x0a\x0a{{if\x20.Playground}}\x0a<script\x20src=\"/lib/godoc/playground.js\"\x20defer></script>\x0a{{end}}\x0a{{with\x20.Version}}<script>var\x20goVersion\x20=\x20{{printf\x20\"%q\"\x20.}};</script>{{end}}\x0a<script\x20src=\"/lib/godoc/godocs.js\"\x20defer></script>\x0a\x0a<body\x20class=\"Site\">\x0a<header\x20class=\"Header\x20js-header\">\x0a\x20\x20<div\x20class=\"Header-banner\">\x0a\x20\x20\x20\x20Black\x20Lives\x20Matter.\x0a\x20\x20\x20\x20<a\x20href=\"https://support.eji.org/give/153413/#!/donation/checkout\"\x0a\x20\x20\x20\x20\x20\x20\x20target=\"_blank\"\x0a\x20\x20\x20\x20\x20\x20\x20rel=\"noopener\">Support\x20the\x20Equal\x20Justice\x20Initiative.</a>\x0a\x20\x20</div>\x0a\x20\x20<nav\x20class=\"Header-nav\x20{{if\x20.Title}}Header-nav--wide{{end}}\">\x0a\x20\x20\x20\x20<a\x20href=\"/\"><img\x20class=\"Header-logo\"\x20src=\"/lib/godoc/images/go-logo-blue.svg\"\x20alt=\"Go\"></a>\x0a\x20\x20\x20\x20<button\x20class=\"Header-menuButton\x20js-headerMenuButton\"\x20aria-label=\"Main\x20menu\"\x20aria-expanded=\"false\">\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\"Header-menuButtonInner\"></div>\x0a\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20<ul\x20class=\"Header-menu\">\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\"><a\x20href=\"/doc/\">Documents</a></li>\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\"><a\x20href=\"/pkg/\">Packages</a></li>\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\"><a\x20href=\"/project/\">The\x20Project</a></li>\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\"><a\x20href=\"/help/\">Help</a></li>\x0a\x20\x20\x20\x20\x20\x20{{if\x20not\x20.GoogleCN}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\"><a\x20href=\"/blog/\">Blog</a></li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20{{if\x20.Playground}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\"><a\x20href=\"https://play.golang.org/\">Play</a></li>\x0a\x20\x20\x20\x20\x20\x20\x20\x20{{end}}\x0a\x20\x20\x20\x20\x20\x20{{end}}\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Header-menuItem\x20Header-menuItem--search\">\x0a\x20\x20\x20\x20\x20\x20\x20\x20<form\x20class=\"HeaderSearch\"\x20role=\"search\"\x20action=\"/search\">\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x20class=\"HeaderSearch-input\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\"search\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name=\"q\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\"Search\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20aria-label=\"Search\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocapitalize=\"off\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\"off\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocorrect=\"off\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\"false\"\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20required>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20class=\"HeaderSearch-submit\">\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<!--\x20magnifying\x20glass:\x20--><svg\x20class=\"HeaderSearch-icon\"\x20width=\"24\"\x20height=\"24\"\x20viewBox=\"0\x200\x2024\x2024\"><title>Search</title><path\x20d=\"M15.5\x2014h-.79l-.28-.27C15.41\x2012.59\x2016\x2011.11\x2016\x209.5\x2016\x205.91\x2013.09\x203\x209.5\x203S3\x205.91\x203\x209.5\x205.91\x2016\x209.5\x2016c1.61\x200\x203.09-.59\x204.23-1.57l.27.28v.79l5\x204.99L20.49\x2019l-4.99-5zm-6\x200C7.01\x2014\x205\x2011.99\x205\x209.5S7.01\x205\x209.5\x205\x2014\x207.01\x2014\x209.5\x2011.99\x2014\x209.5\x2014z\"/><path\x20d=\"M0\x200h24v24H0z\"\x20fill=\"none\"/></svg>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</form>\x0a\x20\x20\x20\x20\x20\x20</li>\x0a\x20\x20\x20\x20</ul>\x0a\x20\x20</nav>\x0a</header>\x0a\x0a<main\x20id=\"page\"\x20class=\"Site-content{{if\x20.Title}}\x20wide{{end}}\">\x0a<div\x20class=\"container\">\x0a\x0a{{if\x20or\x20.Title\x20.SrcPath}}\x0a\x20\x20<h1>\x0a\x20\x20\x20\x20{{html\x20.Title}}\x0a\x20\x20\x20\x20{{html\x20.SrcPath\x20|\x20srcBreadcrumb}}\x0a\x20\x20</h1>\x0a{{end}}\x0a\x0a{{with\x20.Subtitle}}\x0a\x20\x20<h2>{{html\x20.}}</h2>\x0a{{end}}\x0a\x0a{{with\x20.SrcPath}}\x0a\x20\x20<h2>\x0a\x20\x20\x20\x20Documentation:\x20{{html\x20.\x20|\x20srcToPkgLink}}\x0a\x20\x20</h2>\x0a{{end}}\x0a\x0a{{/*\x20The\x20Table\x20of\x20Contents\x20is\x20automatically\x20inserted\x20in\x20this\x20<div>.\x0a\x20\x20\x20\x20\x20Do\x20not\x20delete\x20this\x20<div>.\x20*/}}\x0a<div\x20id=\"nav\"></div>\x0a\x0a{{/*\x20Body\x20is\x20HTML-escaped\x20elsewhere\x20*/}}\x0a{{printf\x20\"%s\"\x20.Body}}\x0a\x0a</div><!--\x20.container\x20-->\x0a</main><!--\x20#page\x20-->\x0a<footer>\x0a\x20\x20<div\x20class=\"Footer\x20{{if\x20.Title}}Footer--wide{{end}}\">\x0a\x20\x20\x20\x20<img\x20class=\"Footer-gopher\"\x20src=\"/lib/godoc/images/footer-gopher.jpg\"\x20alt=\"The\x20Go\x20Gopher\">\x0a\x20\x20\x20\x20<ul\x20class=\"Footer-links\">\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Footer-link\"><a\x20href=\"/doc/copyright.html\">Copyright</a></li>\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Footer-link\"><a\x20href=\"/doc/tos.html\">Terms\x20of\x20Service</a></li>\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Footer-link\"><a\x20href=\"http://www.google.com/intl/en/policies/privacy/\">Privacy\x20Policy</a></li>\x0a\x20\x20\x20\x20\x20\x20<li\x20class=\"Footer-link\"><a\x20href=\"http://golang.org/issues/new?title=x/website:\"\x20target=\"_blank\"\x20rel=\"noopener\">Report\x20a\x20website\x20issue</a></li>\x0a\x20\x20\x20\x20</ul>\x0a\x20\x20\x20\x20<a\x20class=\"Footer-supportedBy\"\x20href=\"https://google.com\">Supported\x20by\x20Google</a>\x0a\x20\x20</div>\x0a</footer>\x0a{{if\x20.GoogleAnalytics}}\x0a<script>\x0a(function()\x20{\x0a\x20\x20var\x20ga\x20=\x20document.createElement(\"script\");\x20ga.type\x20=\x20\"text/javascript\";\x20ga.async\x20=\x20true;\x0a\x20\x20ga.src\x20=\x20(\"https:\"\x20==\x20document.location.protocol\x20?\x20\"https://ssl\"\x20:\x20\"http://www\")\x20+\x20\".google-analytics.com/ga.js\";\x0a\x20\x20var\x20s\x20=\x20document.getElementsByTagName(\"script\")[0];\x20s.parentNode.insertBefore(ga,\x20s);\x0a})();\x0a</script>\x0a{{end}}\x0a\x0a",
 
-	"godocs.js": "//\x20Copyright\x202012\x20The\x20Go\x20Authors.\x20All\x20rights\x20reserved.\x0a//\x20Use\x20of\x20this\x20source\x20code\x20is\x20governed\x20by\x20a\x20BSD-style\x0a//\x20license\x20that\x20can\x20be\x20found\x20in\x20the\x20LICENSE\x20file.\x0a\x0a/*\x20A\x20little\x20code\x20to\x20ease\x20navigation\x20of\x20these\x20documents.\x0a\x20*\x0a\x20*\x20On\x20window\x20load\x20we:\x0a\x20*\x20\x20+\x20Generate\x20a\x20table\x20of\x20contents\x20(generateTOC)\x0a\x20*\x20\x20+\x20Bind\x20foldable\x20sections\x20(bindToggles)\x0a\x20*\x20\x20+\x20Bind\x20links\x20to\x20foldable\x20sections\x20(bindToggleLinks)\x0a\x20*/\x0a\x0a(function()\x20{\x0a\x20\x20'use\x20strict';\x0a\x0a\x20\x20var\x20headerEl\x20=\x20document.querySelector('.js-header');\x0a\x20\x20var\x20menuButtonEl\x20=\x20document.querySelector('.js-headerMenuButton');\x0a\x20\x20menuButtonEl.addEventListener('click',\x20function(e)\x20{\x0a\x20\x20\x20\x20e.preventDefault();\x0a\x20\x20\x20\x20headerEl.classList.toggle('is-active');\x0a\x20\x20\x20\x20menuButtonEl.setAttribute(\x0a\x20\x20\x20\x20\x20\x20'aria-expanded',\x0a\x20\x20\x20\x20\x20\x20headerEl.classList.contains('is-active')\x0a\x20\x20\x20\x20);\x0a\x20\x20});\x0a\x0a\x20\x20/*\x20Generates\x20a\x20table\x20of\x20contents:\x20looks\x20for\x20h2\x20and\x20h3\x20elements\x20and\x20generates\x0a\x20\x20\x20*\x20links.\x20\"Decorates\"\x20the\x20element\x20with\x20id==\"nav\"\x20with\x20this\x20table\x20of\x20contents.\x0a\x20\x20\x20*/\x0a\x20\x20function\x20generateTOC()\x20{\x0a\x20\x20\x20\x20if\x20($('#manual-nav').length\x20>\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20//\x20For\x20search,\x20we\x20send\x20the\x20toc\x20precomputed\x20from\x20server-side.\x0a\x20\x20\x20\x20//\x20TODO:\x20Ideally,\x20this\x20should\x20always\x20be\x20precomputed\x20for\x20all\x20pages,\x20but\x20then\x0a\x20\x20\x20\x20//\x20we\x20need\x20to\x20do\x20HTML\x20parsing\x20on\x20the\x20server-side.\x0a\x20\x20\x20\x20if\x20(location.pathname\x20===\x20'/search')\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20nav\x20=\x20$('#nav');\x0a\x20\x20\x20\x20if\x20(nav.length\x20===\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20toc_items\x20=\x20[];\x0a\x20\x20\x20\x20$(nav)\x0a\x20\x20\x20\x20\x20\x20.nextAll('h2,\x20h3')\x0a\x20\x20\x20\x20\x20\x20.each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20node\x20=\x20this;\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20(node.id\x20==\x20'')\x20node.id\x20=\x20'tmp_'\x20+\x20toc_items.length;\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20link\x20=\x20$('<a/>')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.attr('href',\x20'#'\x20+\x20node.id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.text($(node).text());\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20item;\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20($(node).is('h2'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20item\x20=\x20$('<dt/>');\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20h3\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20item\x20=\x20$('<dd\x20class=\"indent\"/>');\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20item.append(link);\x0a\x20\x20\x20\x20\x20\x20\x20\x20toc_items.push(item);\x0a\x20\x20\x20\x20\x20\x20});\x0a\x20\x20\x20\x20if\x20(toc_items.length\x20<=\x201)\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20var\x20dl1\x20=\x20$('<dl/>');\x0a\x20\x20\x20\x20var\x20dl2\x20=\x20$('<dl/>');\x0a\x0a\x20\x20\x20\x20var\x20split_index\x20=\x20toc_items.length\x20/\x202\x20+\x201;\x0a\x20\x20\x20\x20if\x20(split_index\x20<\x208)\x20{\x0a\x20\x20\x20\x20\x20\x20split_index\x20=\x20toc_items.length;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20for\x20(var\x20i\x20=\x200;\x20i\x20<\x20split_index;\x20i++)\x20{\x0a\x20\x20\x20\x20\x20\x20dl1.append(toc_items[i]);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20for\x20(;\x20/*\x20keep\x20using\x20i\x20*/\x20i\x20<\x20toc_items.length;\x20i++)\x20{\x0a\x20\x20\x20\x20\x20\x20dl2.append(toc_items[i]);\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20tocTable\x20=\x20$('<table\x20class=\"unruled\"/>').appendTo(nav);\x0a\x20\x20\x20\x20var\x20tocBody\x20=\x20$('<tbody/>').appendTo(tocTable);\x0a\x20\x20\x20\x20var\x20tocRow\x20=\x20$('<tr/>').appendTo(tocBody);\x0a\x0a\x20\x20\x20\x20//\x201st\x20column\x0a\x20\x20\x20\x20$('<td\x20class=\"first\"/>')\x0a\x20\x20\x20\x20\x20\x20.appendTo(tocRow)\x0a\x20\x20\x20\x20\x20\x20.append(dl1);\x0a\x20\x20\x20\x20//\x202nd\x20column\x0a\x20\x20\x20\x20$('<td/>')\x0a\x20\x20\x20\x20\x20\x20.appendTo(tocRow)\x0a\x20\x20\x20\x20\x20\x20.append(dl2);\x0a\x20\x20}\x0a\x0a\x20\x20function\x20bindToggle(el)\x20{\x0a\x20\x20\x20\x20$('.toggleButton',\x20el).click(function()\x20{\x0a\x20\x20\x20\x20\x20\x20if\x20($(this).closest('.toggle,\x20.toggleVisible')[0]\x20!=\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Only\x20trigger\x20the\x20closest\x20toggle\x20header.\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20if\x20($(el).is('.toggle'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(el)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.addClass('toggleVisible')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.removeClass('toggle');\x0a\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(el)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.addClass('toggle')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.removeClass('toggleVisible');\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20function\x20bindToggles(selector)\x20{\x0a\x20\x20\x20\x20$(selector).each(function(i,\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20bindToggle(el);\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20function\x20bindToggleLink(el,\x20prefix)\x20{\x0a\x20\x20\x20\x20$(el).click(function()\x20{\x0a\x20\x20\x20\x20\x20\x20var\x20href\x20=\x20$(el).attr('href');\x0a\x20\x20\x20\x20\x20\x20var\x20i\x20=\x20href.indexOf('#'\x20+\x20prefix);\x0a\x20\x20\x20\x20\x20\x20if\x20(i\x20<\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20var\x20id\x20=\x20'#'\x20+\x20prefix\x20+\x20href.slice(i\x20+\x201\x20+\x20prefix.length);\x0a\x20\x20\x20\x20\x20\x20if\x20($(id).is('.toggle'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.find('.toggleButton')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.first()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.click();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20function\x20bindToggleLinks(selector,\x20prefix)\x20{\x0a\x20\x20\x20\x20$(selector).each(function(i,\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20bindToggleLink(el,\x20prefix);\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20function\x20setupInlinePlayground()\x20{\x0a\x20\x20\x20\x20'use\x20strict';\x0a\x20\x20\x20\x20//\x20Set\x20up\x20playground\x20when\x20each\x20element\x20is\x20toggled.\x0a\x20\x20\x20\x20$('div.play').each(function(i,\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20Set\x20up\x20playground\x20for\x20this\x20example.\x0a\x20\x20\x20\x20\x20\x20var\x20setup\x20=\x20function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20code\x20=\x20$('.code',\x20el);\x0a\x20\x20\x20\x20\x20\x20\x20\x20playground({\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20codeEl:\x20code,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20outputEl:\x20$('.output',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20runEl:\x20$('.run',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20fmtEl:\x20$('.fmt',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20shareEl:\x20$('.share',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20shareRedirect:\x20'//play.golang.org/p/',\x0a\x20\x20\x20\x20\x20\x20\x20\x20});\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Make\x20the\x20code\x20textarea\x20resize\x20to\x20fit\x20content.\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20resize\x20=\x20function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20code.height(0);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20var\x20h\x20=\x20code[0].scrollHeight;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20code.height(h\x20+\x2020);\x20//\x20minimize\x20bouncing.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20code.closest('.input').height(h);\x0a\x20\x20\x20\x20\x20\x20\x20\x20};\x0a\x20\x20\x20\x20\x20\x20\x20\x20code.on('keydown',\x20resize);\x0a\x20\x20\x20\x20\x20\x20\x20\x20code.on('keyup',\x20resize);\x0a\x20\x20\x20\x20\x20\x20\x20\x20code.keyup();\x20//\x20resize\x20now.\x0a\x20\x20\x20\x20\x20\x20};\x0a\x0a\x20\x20\x20\x20\x20\x20//\x20If\x20example\x20already\x20visible,\x20set\x20up\x20playground\x20now.\x0a\x20\x20\x20\x20\x20\x20if\x20($(el).is(':visible'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20setup();\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20//\x20Otherwise,\x20set\x20up\x20playground\x20when\x20example\x20is\x20expanded.\x0a\x20\x20\x20\x20\x20\x20var\x20built\x20=\x20false;\x0a\x20\x20\x20\x20\x20\x20$(el)\x0a\x20\x20\x20\x20\x20\x20\x20\x20.closest('.toggle')\x0a\x20\x20\x20\x20\x20\x20\x20\x20.click(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Only\x20set\x20up\x20once.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if\x20(!built)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20setup();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20built\x20=\x20true;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20});\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20//\x20fixFocus\x20tries\x20to\x20put\x20focus\x20to\x20#page\x20so\x20that\x20keyboard\x20navigation\x20works.\x0a\x20\x20function\x20fixFocus()\x20{\x0a\x20\x20\x20\x20var\x20page\x20=\x20$('#page');\x0a\x20\x20\x20\x20var\x20topbar\x20=\x20$('div#topbar');\x0a\x20\x20\x20\x20page.css('outline',\x200);\x20//\x20disable\x20outline\x20when\x20focused\x0a\x20\x20\x20\x20page.attr('tabindex',\x20-1);\x20//\x20and\x20set\x20tabindex\x20so\x20that\x20it\x20is\x20focusable\x0a\x20\x20\x20\x20$(window)\x0a\x20\x20\x20\x20\x20\x20.resize(function(evt)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20only\x20focus\x20page\x20when\x20the\x20topbar\x20is\x20at\x20fixed\x20position\x20(that\x20is,\x20it's\x20in\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20front\x20of\x20page,\x20and\x20keyboard\x20event\x20will\x20go\x20to\x20the\x20former\x20by\x20default.)\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20by\x20focusing\x20page,\x20keyboard\x20event\x20will\x20go\x20to\x20page\x20so\x20that\x20up/down\x20arrow,\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20space,\x20etc.\x20will\x20work\x20as\x20expected.\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20(topbar.css('position')\x20==\x20'fixed')\x20page.focus();\x0a\x20\x20\x20\x20\x20\x20})\x0a\x20\x20\x20\x20\x20\x20.resize();\x0a\x20\x20}\x0a\x0a\x20\x20function\x20toggleHash()\x20{\x0a\x20\x20\x20\x20var\x20id\x20=\x20window.location.hash.substring(1);\x0a\x20\x20\x20\x20//\x20Open\x20all\x20of\x20the\x20toggles\x20for\x20a\x20particular\x20hash.\x0a\x20\x20\x20\x20var\x20els\x20=\x20$(\x0a\x20\x20\x20\x20\x20\x20document.getElementById(id),\x0a\x20\x20\x20\x20\x20\x20$('a[name]').filter(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20return\x20$(this).attr('name')\x20==\x20id;\x0a\x20\x20\x20\x20\x20\x20})\x0a\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20while\x20(els.length)\x20{\x0a\x20\x20\x20\x20\x20\x20for\x20(var\x20i\x20=\x200;\x20i\x20<\x20els.length;\x20i++)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20el\x20=\x20$(els[i]);\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20(el.is('.toggle'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20el.find('.toggleButton')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.first()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.click();\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20els\x20=\x20el.parent();\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x0a\x20\x20function\x20personalizeInstallInstructions()\x20{\x0a\x20\x20\x20\x20var\x20prefix\x20=\x20'?download=';\x0a\x20\x20\x20\x20var\x20s\x20=\x20window.location.search;\x0a\x20\x20\x20\x20if\x20(s.indexOf(prefix)\x20!=\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20No\x20'download'\x20query\x20string;\x20detect\x20\"test\"\x20instructions\x20from\x20User\x20Agent.\x0a\x20\x20\x20\x20\x20\x20if\x20(navigator.platform.indexOf('Win')\x20!=\x20-1)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testUnix').hide();\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testWindows').show();\x0a\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testUnix').show();\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testWindows').hide();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20filename\x20=\x20s.substr(prefix.length);\x0a\x20\x20\x20\x20var\x20filenameRE\x20=\x20/^go1\\.\\d+(\\.\\d+)?([a-z0-9]+)?\\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\\.[68])?\\.([a-z.]+)$/;\x0a\x20\x20\x20\x20var\x20m\x20=\x20filenameRE.exec(filename);\x0a\x20\x20\x20\x20if\x20(!m)\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20Can't\x20interpret\x20file\x20name;\x20bail.\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20$('.downloadFilename').text(filename);\x0a\x20\x20\x20\x20$('.hideFromDownload').hide();\x0a\x0a\x20\x20\x20\x20var\x20os\x20=\x20m[3];\x0a\x20\x20\x20\x20var\x20ext\x20=\x20m[6];\x0a\x20\x20\x20\x20if\x20(ext\x20!=\x20'tar.gz')\x20{\x0a\x20\x20\x20\x20\x20\x20$('#tarballInstructions').hide();\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20if\x20(os\x20!=\x20'darwin'\x20||\x20ext\x20!=\x20'pkg')\x20{\x0a\x20\x20\x20\x20\x20\x20$('#darwinPackageInstructions').hide();\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20if\x20(os\x20!=\x20'windows')\x20{\x0a\x20\x20\x20\x20\x20\x20$('#windowsInstructions').hide();\x0a\x20\x20\x20\x20\x20\x20$('.testUnix').show();\x0a\x20\x20\x20\x20\x20\x20$('.testWindows').hide();\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20if\x20(ext\x20!=\x20'msi')\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('#windowsInstallerInstructions').hide();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20if\x20(ext\x20!=\x20'zip')\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('#windowsZipInstructions').hide();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20$('.testUnix').hide();\x0a\x20\x20\x20\x20\x20\x20$('.testWindows').show();\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20download\x20=\x20'https://dl.google.com/go/'\x20+\x20filename;\x0a\x0a\x20\x20\x20\x20var\x20message\x20=\x20$(\x0a\x20\x20\x20\x20\x20\x20'<p\x20class=\"downloading\">'\x20+\x0a\x20\x20\x20\x20\x20\x20\x20\x20'Your\x20download\x20should\x20begin\x20shortly.\x20'\x20+\x0a\x20\x20\x20\x20\x20\x20\x20\x20'If\x20it\x20does\x20not,\x20click\x20<a>this\x20link</a>.</p>'\x0a\x20\x20\x20\x20);\x0a\x20\x20\x20\x20message.find('a').attr('href',\x20download);\x0a\x20\x20\x20\x20message.insertAfter('#nav');\x0a\x0a\x20\x20\x20\x20window.location\x20=\x20download;\x0a\x20\x20}\x0a\x0a\x20\x20function\x20updateVersionTags()\x20{\x0a\x20\x20\x20\x20var\x20v\x20=\x20window.goVersion;\x0a\x20\x20\x20\x20if\x20(/^go[0-9.]+$/.test(v))\x20{\x0a\x20\x20\x20\x20\x20\x20$('.versionTag')\x0a\x20\x20\x20\x20\x20\x20\x20\x20.empty()\x0a\x20\x20\x20\x20\x20\x20\x20\x20.text(v);\x0a\x20\x20\x20\x20\x20\x20$('.whereTag').hide();\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x0a\x20\x20function\x20addPermalinks()\x20{\x0a\x20\x20\x20\x20function\x20addPermalink(source,\x20parent)\x20{\x0a\x20\x20\x20\x20\x20\x20var\x20id\x20=\x20source.attr('id');\x0a\x20\x20\x20\x20\x20\x20if\x20(id\x20==\x20''\x20||\x20id.indexOf('tmp_')\x20===\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Auto-generated\x20permalink.\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20if\x20(parent.find('>\x20.permalink').length)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Already\x20attached.\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20parent\x0a\x20\x20\x20\x20\x20\x20\x20\x20.append('\x20')\x0a\x20\x20\x20\x20\x20\x20\x20\x20.append($(\"<a\x20class='permalink'>&#xb6;</a>\").attr('href',\x20'#'\x20+\x20id));\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20$('#page\x20.container')\x0a\x20\x20\x20\x20\x20\x20.find('h2[id],\x20h3[id]')\x0a\x20\x20\x20\x20\x20\x20.each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20el\x20=\x20$(this);\x0a\x20\x20\x20\x20\x20\x20\x20\x20addPermalink(el,\x20el);\x0a\x20\x20\x20\x20\x20\x20});\x0a\x0a\x20\x20\x20\x20$('#page\x20.container')\x0a\x20\x20\x20\x20\x20\x20.find('dl[id]')\x0a\x20\x20\x20\x20\x20\x20.each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20el\x20=\x20$(this);\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Add\x20the\x20anchor\x20to\x20the\x20\"dt\"\x20element.\x0a\x20\x20\x20\x20\x20\x20\x20\x20addPermalink(el,\x20el.find('>\x20dt').first());\x0a\x20\x20\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20$('.js-expandAll').click(function()\x20{\x0a\x20\x20\x20\x20if\x20($(this).hasClass('collapsed'))\x20{\x0a\x20\x20\x20\x20\x20\x20toggleExamples('toggle');\x0a\x20\x20\x20\x20\x20\x20$(this).text('(Collapse\x20All)');\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20toggleExamples('toggleVisible');\x0a\x20\x20\x20\x20\x20\x20$(this).text('(Expand\x20All)');\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20$(this).toggleClass('collapsed');\x0a\x20\x20});\x0a\x0a\x20\x20function\x20toggleExamples(className)\x20{\x0a\x20\x20\x20\x20//\x20We\x20need\x20to\x20explicitly\x20iterate\x20through\x20divs\x20starting\x20with\x20\"example_\"\x0a\x20\x20\x20\x20//\x20to\x20avoid\x20toggling\x20Overview\x20and\x20Index\x20collapsibles.\x0a\x20\x20\x20\x20$(\"[id^='example_']\").each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20Check\x20for\x20state\x20and\x20click\x20it\x20only\x20if\x20required.\x0a\x20\x20\x20\x20\x20\x20if\x20($(this).hasClass(className))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(this)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.find('.toggleButton')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.first()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.click();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20$(document).ready(function()\x20{\x0a\x20\x20\x20\x20generateTOC();\x0a\x20\x20\x20\x20addPermalinks();\x0a\x20\x20\x20\x20bindToggles('.toggle');\x0a\x20\x20\x20\x20bindToggles('.toggleVisible');\x0a\x20\x20\x20\x20bindToggleLinks('.exampleLink',\x20'example_');\x0a\x20\x20\x20\x20bindToggleLinks('.overviewLink',\x20'');\x0a\x20\x20\x20\x20bindToggleLinks('.examplesLink',\x20'');\x0a\x20\x20\x20\x20bindToggleLinks('.indexLink',\x20'');\x0a\x20\x20\x20\x20setupInlinePlayground();\x0a\x20\x20\x20\x20fixFocus();\x0a\x20\x20\x20\x20toggleHash();\x0a\x20\x20\x20\x20personalizeInstallInstructions();\x0a\x20\x20\x20\x20updateVersionTags();\x0a\x0a\x20\x20\x20\x20//\x20godoc.html\x20defines\x20window.initFuncs\x20in\x20the\x20<head>\x20tag,\x20and\x20root.html\x20and\x0a\x20\x20\x20\x20//\x20codewalk.js\x20push\x20their\x20on-page-ready\x20functions\x20to\x20the\x20list.\x0a\x20\x20\x20\x20//\x20We\x20execute\x20those\x20functions\x20here,\x20to\x20avoid\x20loading\x20jQuery\x20until\x20the\x20page\x0a\x20\x20\x20\x20//\x20content\x20is\x20loaded.\x0a\x20\x20\x20\x20for\x20(var\x20i\x20=\x200;\x20i\x20<\x20window.initFuncs.length;\x20i++)\x20window.initFuncs[i]();\x0a\x20\x20});\x0a})();\x0a",
+	"godocs.js": "//\x20Copyright\x202012\x20The\x20Go\x20Authors.\x20All\x20rights\x20reserved.\x0a//\x20Use\x20of\x20this\x20source\x20code\x20is\x20governed\x20by\x20a\x20BSD-style\x0a//\x20license\x20that\x20can\x20be\x20found\x20in\x20the\x20LICENSE\x20file.\x0a\x0a/*\x20A\x20little\x20code\x20to\x20ease\x20navigation\x20of\x20these\x20documents.\x0a\x20*\x0a\x20*\x20On\x20window\x20load\x20we:\x0a\x20*\x20\x20+\x20Generate\x20a\x20table\x20of\x20contents\x20(generateTOC)\x0a\x20*\x20\x20+\x20Bind\x20foldable\x20sections\x20(bindToggles)\x0a\x20*\x20\x20+\x20Bind\x20links\x20to\x20foldable\x20sections\x20(bindToggleLinks)\x0a\x20*/\x0a\x0a(function()\x20{\x0a\x20\x20'use\x20strict';\x0a\x0a\x20\x20var\x20headerEl\x20=\x20document.querySelector('.js-header');\x0a\x20\x20var\x20menuButtonEl\x20=\x20document.querySelector('.js-headerMenuButton');\x0a\x20\x20menuButtonEl.addEventListener('click',\x20function(e)\x20{\x0a\x20\x20\x20\x20e.preventDefault();\x0a\x20\x20\x20\x20headerEl.classList.toggle('is-active');\x0a\x20\x20\x20\x20menuButtonEl.setAttribute(\x0a\x20\x20\x20\x20\x20\x20'aria-expanded',\x0a\x20\x20\x20\x20\x20\x20headerEl.classList.contains('is-active')\x0a\x20\x20\x20\x20);\x0a\x20\x20});\x0a\x0a\x20\x20/*\x20Generates\x20a\x20table\x20of\x20contents:\x20looks\x20for\x20h2\x20and\x20h3\x20elements\x20and\x20generates\x0a\x20\x20\x20*\x20links.\x20\"Decorates\"\x20the\x20element\x20with\x20id==\"nav\"\x20with\x20this\x20table\x20of\x20contents.\x0a\x20\x20\x20*/\x0a\x20\x20function\x20generateTOC()\x20{\x0a\x20\x20\x20\x20if\x20($('#manual-nav').length\x20>\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20//\x20For\x20search,\x20we\x20send\x20the\x20toc\x20precomputed\x20from\x20server-side.\x0a\x20\x20\x20\x20//\x20TODO:\x20Ideally,\x20this\x20should\x20always\x20be\x20precomputed\x20for\x20all\x20pages,\x20but\x20then\x0a\x20\x20\x20\x20//\x20we\x20need\x20to\x20do\x20HTML\x20parsing\x20on\x20the\x20server-side.\x0a\x20\x20\x20\x20if\x20(location.pathname\x20===\x20'/search')\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20nav\x20=\x20$('#nav');\x0a\x20\x20\x20\x20if\x20(nav.length\x20===\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20toc_items\x20=\x20[];\x0a\x20\x20\x20\x20$(nav)\x0a\x20\x20\x20\x20\x20\x20.nextAll('h2,\x20h3')\x0a\x20\x20\x20\x20\x20\x20.each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20node\x20=\x20this;\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20(node.id\x20==\x20'')\x20node.id\x20=\x20'tmp_'\x20+\x20toc_items.length;\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20link\x20=\x20$('<a/>')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.attr('href',\x20'#'\x20+\x20node.id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.text($(node).text());\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20item;\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20($(node).is('h2'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20item\x20=\x20$('<dt/>');\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20h3\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20item\x20=\x20$('<dd\x20class=\"indent\"/>');\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20item.append(link);\x0a\x20\x20\x20\x20\x20\x20\x20\x20toc_items.push(item);\x0a\x20\x20\x20\x20\x20\x20});\x0a\x20\x20\x20\x20if\x20(toc_items.length\x20<=\x201)\x20{\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20var\x20dl1\x20=\x20$('<dl/>');\x0a\x20\x20\x20\x20var\x20dl2\x20=\x20$('<dl/>');\x0a\x0a\x20\x20\x20\x20var\x20split_index\x20=\x20toc_items.length\x20/\x202\x20+\x201;\x0a\x20\x20\x20\x20if\x20(split_index\x20<\x208)\x20{\x0a\x20\x20\x20\x20\x20\x20split_index\x20=\x20toc_items.length;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20for\x20(var\x20i\x20=\x200;\x20i\x20<\x20split_index;\x20i++)\x20{\x0a\x20\x20\x20\x20\x20\x20dl1.append(toc_items[i]);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20for\x20(;\x20/*\x20keep\x20using\x20i\x20*/\x20i\x20<\x20toc_items.length;\x20i++)\x20{\x0a\x20\x20\x20\x20\x20\x20dl2.append(toc_items[i]);\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20tocTable\x20=\x20$('<table\x20class=\"unruled\"/>').appendTo(nav);\x0a\x20\x20\x20\x20var\x20tocBody\x20=\x20$('<tbody/>').appendTo(tocTable);\x0a\x20\x20\x20\x20var\x20tocRow\x20=\x20$('<tr/>').appendTo(tocBody);\x0a\x0a\x20\x20\x20\x20//\x201st\x20column\x0a\x20\x20\x20\x20$('<td\x20class=\"first\"/>')\x0a\x20\x20\x20\x20\x20\x20.appendTo(tocRow)\x0a\x20\x20\x20\x20\x20\x20.append(dl1);\x0a\x20\x20\x20\x20//\x202nd\x20column\x0a\x20\x20\x20\x20$('<td/>')\x0a\x20\x20\x20\x20\x20\x20.appendTo(tocRow)\x0a\x20\x20\x20\x20\x20\x20.append(dl2);\x0a\x20\x20}\x0a\x0a\x20\x20function\x20bindToggle(el)\x20{\x0a\x20\x20\x20\x20$('.toggleButton',\x20el).click(function()\x20{\x0a\x20\x20\x20\x20\x20\x20if\x20($(this).closest('.toggle,\x20.toggleVisible')[0]\x20!=\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Only\x20trigger\x20the\x20closest\x20toggle\x20header.\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20if\x20($(el).is('.toggle'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(el)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.addClass('toggleVisible')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.removeClass('toggle');\x0a\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(el)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.addClass('toggle')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.removeClass('toggleVisible');\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20function\x20bindToggles(selector)\x20{\x0a\x20\x20\x20\x20$(selector).each(function(i,\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20bindToggle(el);\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20function\x20bindToggleLink(el,\x20prefix)\x20{\x0a\x20\x20\x20\x20$(el).click(function()\x20{\x0a\x20\x20\x20\x20\x20\x20var\x20href\x20=\x20$(el).attr('href');\x0a\x20\x20\x20\x20\x20\x20var\x20i\x20=\x20href.indexOf('#'\x20+\x20prefix);\x0a\x20\x20\x20\x20\x20\x20if\x20(i\x20<\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20var\x20id\x20=\x20'#'\x20+\x20prefix\x20+\x20href.slice(i\x20+\x201\x20+\x20prefix.length);\x0a\x20\x20\x20\x20\x20\x20if\x20($(id).is('.toggle'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(id)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.find('.toggleButton')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.first()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.click();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20function\x20bindToggleLinks(selector,\x20prefix)\x20{\x0a\x20\x20\x20\x20$(selector).each(function(i,\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20bindToggleLink(el,\x20prefix);\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20function\x20setupInlinePlayground()\x20{\x0a\x20\x20\x20\x20'use\x20strict';\x0a\x20\x20\x20\x20//\x20Set\x20up\x20playground\x20when\x20each\x20element\x20is\x20toggled.\x0a\x20\x20\x20\x20$('div.play').each(function(i,\x20el)\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20Set\x20up\x20playground\x20for\x20this\x20example.\x0a\x20\x20\x20\x20\x20\x20var\x20setup\x20=\x20function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20code\x20=\x20$('.code',\x20el);\x0a\x20\x20\x20\x20\x20\x20\x20\x20playground({\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20codeEl:\x20code,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20outputEl:\x20$('.output',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20runEl:\x20$('.run',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20fmtEl:\x20$('.fmt',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20shareEl:\x20$('.share',\x20el),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20shareRedirect:\x20'//play.golang.org/p/',\x0a\x20\x20\x20\x20\x20\x20\x20\x20});\x0a\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Make\x20the\x20code\x20textarea\x20resize\x20to\x20fit\x20content.\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20resize\x20=\x20function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20code.height(0);\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20var\x20h\x20=\x20code[0].scrollHeight;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20code.height(h\x20+\x2020);\x20//\x20minimize\x20bouncing.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20code.closest('.input').height(h);\x0a\x20\x20\x20\x20\x20\x20\x20\x20};\x0a\x20\x20\x20\x20\x20\x20\x20\x20code.on('keydown',\x20resize);\x0a\x20\x20\x20\x20\x20\x20\x20\x20code.on('keyup',\x20resize);\x0a\x20\x20\x20\x20\x20\x20\x20\x20code.keyup();\x20//\x20resize\x20now.\x0a\x20\x20\x20\x20\x20\x20};\x0a\x0a\x20\x20\x20\x20\x20\x20//\x20If\x20example\x20already\x20visible,\x20set\x20up\x20playground\x20now.\x0a\x20\x20\x20\x20\x20\x20if\x20($(el).is(':visible'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20setup();\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20\x20\x20//\x20Otherwise,\x20set\x20up\x20playground\x20when\x20example\x20is\x20expanded.\x0a\x20\x20\x20\x20\x20\x20var\x20built\x20=\x20false;\x0a\x20\x20\x20\x20\x20\x20$(el)\x0a\x20\x20\x20\x20\x20\x20\x20\x20.closest('.toggle')\x0a\x20\x20\x20\x20\x20\x20\x20\x20.click(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20Only\x20set\x20up\x20once.\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20if\x20(!built)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20setup();\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20built\x20=\x20true;\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20});\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20//\x20fixFocus\x20tries\x20to\x20put\x20focus\x20to\x20#page\x20so\x20that\x20keyboard\x20navigation\x20works.\x0a\x20\x20function\x20fixFocus()\x20{\x0a\x20\x20\x20\x20var\x20page\x20=\x20$('#page');\x0a\x20\x20\x20\x20var\x20topbar\x20=\x20$('div#topbar');\x0a\x20\x20\x20\x20page.css('outline',\x200);\x20//\x20disable\x20outline\x20when\x20focused\x0a\x20\x20\x20\x20page.attr('tabindex',\x20-1);\x20//\x20and\x20set\x20tabindex\x20so\x20that\x20it\x20is\x20focusable\x0a\x20\x20\x20\x20$(window)\x0a\x20\x20\x20\x20\x20\x20.resize(function(evt)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20only\x20focus\x20page\x20when\x20the\x20topbar\x20is\x20at\x20fixed\x20position\x20(that\x20is,\x20it's\x20in\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20front\x20of\x20page,\x20and\x20keyboard\x20event\x20will\x20go\x20to\x20the\x20former\x20by\x20default.)\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20by\x20focusing\x20page,\x20keyboard\x20event\x20will\x20go\x20to\x20page\x20so\x20that\x20up/down\x20arrow,\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20space,\x20etc.\x20will\x20work\x20as\x20expected.\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20(topbar.css('position')\x20==\x20'fixed')\x20page.focus();\x0a\x20\x20\x20\x20\x20\x20})\x0a\x20\x20\x20\x20\x20\x20.resize();\x0a\x20\x20}\x0a\x0a\x20\x20function\x20toggleHash()\x20{\x0a\x20\x20\x20\x20var\x20id\x20=\x20window.location.hash.substring(1);\x0a\x20\x20\x20\x20//\x20Open\x20all\x20of\x20the\x20toggles\x20for\x20a\x20particular\x20hash.\x0a\x20\x20\x20\x20var\x20els\x20=\x20$(\x0a\x20\x20\x20\x20\x20\x20document.getElementById(id),\x0a\x20\x20\x20\x20\x20\x20$('a[name]').filter(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20return\x20$(this).attr('name')\x20==\x20id;\x0a\x20\x20\x20\x20\x20\x20})\x0a\x20\x20\x20\x20);\x0a\x0a\x20\x20\x20\x20while\x20(els.length)\x20{\x0a\x20\x20\x20\x20\x20\x20for\x20(var\x20i\x20=\x200;\x20i\x20<\x20els.length;\x20i++)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20el\x20=\x20$(els[i]);\x0a\x20\x20\x20\x20\x20\x20\x20\x20if\x20(el.is('.toggle'))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20el.find('.toggleButton')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.first()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.click();\x0a\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20els\x20=\x20el.parent();\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x0a\x20\x20function\x20personalizeInstallInstructions()\x20{\x0a\x20\x20\x20\x20var\x20prefix\x20=\x20'?download=';\x0a\x20\x20\x20\x20var\x20s\x20=\x20window.location.search;\x0a\x20\x20\x20\x20if\x20(s.indexOf(prefix)\x20!=\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20No\x20'download'\x20query\x20string;\x20detect\x20\"test\"\x20instructions\x20from\x20User\x20Agent.\x0a\x20\x20\x20\x20\x20\x20if\x20(navigator.platform.indexOf('Win')\x20!=\x20-1)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testUnix').hide();\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testWindows').show();\x0a\x20\x20\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testUnix').show();\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('.testWindows').hide();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20filename\x20=\x20s.substr(prefix.length);\x0a\x20\x20\x20\x20var\x20filenameRE\x20=\x20/^go1\\.\\d+(\\.\\d+)?([a-z0-9]+)?\\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\\.[68])?\\.([a-z.]+)$/;\x0a\x20\x20\x20\x20var\x20m\x20=\x20filenameRE.exec(filename);\x0a\x20\x20\x20\x20if\x20(!m)\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20Can't\x20interpret\x20file\x20name;\x20bail.\x0a\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20$('.downloadFilename').text(filename);\x0a\x20\x20\x20\x20$('.hideFromDownload').hide();\x0a\x0a\x20\x20\x20\x20var\x20os\x20=\x20m[3];\x0a\x20\x20\x20\x20var\x20ext\x20=\x20m[6];\x0a\x20\x20\x20\x20if\x20(ext\x20!=\x20'tar.gz')\x20{\x0a\x20\x20\x20\x20\x20\x20$('#tarballInstructions').hide();\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20if\x20(os\x20!=\x20'darwin'\x20||\x20ext\x20!=\x20'pkg')\x20{\x0a\x20\x20\x20\x20\x20\x20$('#darwinPackageInstructions').hide();\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20if\x20(os\x20!=\x20'windows')\x20{\x0a\x20\x20\x20\x20\x20\x20$('#windowsInstructions').hide();\x0a\x20\x20\x20\x20\x20\x20$('.testUnix').show();\x0a\x20\x20\x20\x20\x20\x20$('.testWindows').hide();\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20if\x20(ext\x20!=\x20'msi')\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('#windowsInstallerInstructions').hide();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20if\x20(ext\x20!=\x20'zip')\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$('#windowsZipInstructions').hide();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20$('.testUnix').hide();\x0a\x20\x20\x20\x20\x20\x20$('.testWindows').show();\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20var\x20download\x20=\x20'/dl/'\x20+\x20filename;\x0a\x0a\x20\x20\x20\x20var\x20message\x20=\x20$(\x0a\x20\x20\x20\x20\x20\x20'<p\x20class=\"downloading\">'\x20+\x0a\x20\x20\x20\x20\x20\x20\x20\x20'Your\x20download\x20should\x20begin\x20shortly.\x20'\x20+\x0a\x20\x20\x20\x20\x20\x20\x20\x20'If\x20it\x20does\x20not,\x20click\x20<a>this\x20link</a>.</p>'\x0a\x20\x20\x20\x20);\x0a\x20\x20\x20\x20message.find('a').attr('href',\x20download);\x0a\x20\x20\x20\x20message.insertAfter('#nav');\x0a\x0a\x20\x20\x20\x20window.location\x20=\x20download;\x0a\x20\x20}\x0a\x0a\x20\x20function\x20updateVersionTags()\x20{\x0a\x20\x20\x20\x20var\x20v\x20=\x20window.goVersion;\x0a\x20\x20\x20\x20if\x20(/^go[0-9.]+$/.test(v))\x20{\x0a\x20\x20\x20\x20\x20\x20$('.versionTag')\x0a\x20\x20\x20\x20\x20\x20\x20\x20.empty()\x0a\x20\x20\x20\x20\x20\x20\x20\x20.text(v);\x0a\x20\x20\x20\x20\x20\x20$('.whereTag').hide();\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x0a\x20\x20function\x20addPermalinks()\x20{\x0a\x20\x20\x20\x20function\x20addPermalink(source,\x20parent)\x20{\x0a\x20\x20\x20\x20\x20\x20var\x20id\x20=\x20source.attr('id');\x0a\x20\x20\x20\x20\x20\x20if\x20(id\x20==\x20''\x20||\x20id.indexOf('tmp_')\x20===\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Auto-generated\x20permalink.\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20if\x20(parent.find('>\x20.permalink').length)\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Already\x20attached.\x0a\x20\x20\x20\x20\x20\x20\x20\x20return;\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20parent\x0a\x20\x20\x20\x20\x20\x20\x20\x20.append('\x20')\x0a\x20\x20\x20\x20\x20\x20\x20\x20.append($(\"<a\x20class='permalink'>&#xb6;</a>\").attr('href',\x20'#'\x20+\x20id));\x0a\x20\x20\x20\x20}\x0a\x0a\x20\x20\x20\x20$('#page\x20.container')\x0a\x20\x20\x20\x20\x20\x20.find('h2[id],\x20h3[id]')\x0a\x20\x20\x20\x20\x20\x20.each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20el\x20=\x20$(this);\x0a\x20\x20\x20\x20\x20\x20\x20\x20addPermalink(el,\x20el);\x0a\x20\x20\x20\x20\x20\x20});\x0a\x0a\x20\x20\x20\x20$('#page\x20.container')\x0a\x20\x20\x20\x20\x20\x20.find('dl[id]')\x0a\x20\x20\x20\x20\x20\x20.each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20var\x20el\x20=\x20$(this);\x0a\x20\x20\x20\x20\x20\x20\x20\x20//\x20Add\x20the\x20anchor\x20to\x20the\x20\"dt\"\x20element.\x0a\x20\x20\x20\x20\x20\x20\x20\x20addPermalink(el,\x20el.find('>\x20dt').first());\x0a\x20\x20\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20$('.js-expandAll').click(function()\x20{\x0a\x20\x20\x20\x20if\x20($(this).hasClass('collapsed'))\x20{\x0a\x20\x20\x20\x20\x20\x20toggleExamples('toggle');\x0a\x20\x20\x20\x20\x20\x20$(this).text('(Collapse\x20All)');\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20toggleExamples('toggleVisible');\x0a\x20\x20\x20\x20\x20\x20$(this).text('(Expand\x20All)');\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20$(this).toggleClass('collapsed');\x0a\x20\x20});\x0a\x0a\x20\x20function\x20toggleExamples(className)\x20{\x0a\x20\x20\x20\x20//\x20We\x20need\x20to\x20explicitly\x20iterate\x20through\x20divs\x20starting\x20with\x20\"example_\"\x0a\x20\x20\x20\x20//\x20to\x20avoid\x20toggling\x20Overview\x20and\x20Index\x20collapsibles.\x0a\x20\x20\x20\x20$(\"[id^='example_']\").each(function()\x20{\x0a\x20\x20\x20\x20\x20\x20//\x20Check\x20for\x20state\x20and\x20click\x20it\x20only\x20if\x20required.\x0a\x20\x20\x20\x20\x20\x20if\x20($(this).hasClass(className))\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20$(this)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.find('.toggleButton')\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.first()\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20.click();\x0a\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x0a\x20\x20$(document).ready(function()\x20{\x0a\x20\x20\x20\x20generateTOC();\x0a\x20\x20\x20\x20addPermalinks();\x0a\x20\x20\x20\x20bindToggles('.toggle');\x0a\x20\x20\x20\x20bindToggles('.toggleVisible');\x0a\x20\x20\x20\x20bindToggleLinks('.exampleLink',\x20'example_');\x0a\x20\x20\x20\x20bindToggleLinks('.overviewLink',\x20'');\x0a\x20\x20\x20\x20bindToggleLinks('.examplesLink',\x20'');\x0a\x20\x20\x20\x20bindToggleLinks('.indexLink',\x20'');\x0a\x20\x20\x20\x20setupInlinePlayground();\x0a\x20\x20\x20\x20fixFocus();\x0a\x20\x20\x20\x20toggleHash();\x0a\x20\x20\x20\x20personalizeInstallInstructions();\x0a\x20\x20\x20\x20updateVersionTags();\x0a\x0a\x20\x20\x20\x20//\x20godoc.html\x20defines\x20window.initFuncs\x20in\x20the\x20<head>\x20tag,\x20and\x20root.html\x20and\x0a\x20\x20\x20\x20//\x20codewalk.js\x20push\x20their\x20on-page-ready\x20functions\x20to\x20the\x20list.\x0a\x20\x20\x20\x20//\x20We\x20execute\x20those\x20functions\x20here,\x20to\x20avoid\x20loading\x20jQuery\x20until\x20the\x20page\x0a\x20\x20\x20\x20//\x20content\x20is\x20loaded.\x0a\x20\x20\x20\x20for\x20(var\x20i\x20=\x200;\x20i\x20<\x20window.initFuncs.length;\x20i++)\x20window.initFuncs[i]();\x0a\x20\x20});\x0a})();\x0a",
 
 	"images/cloud-download.svg": "<svg\x20xmlns=\"http://www.w3.org/2000/svg\"\x20width=\"24\"\x20height=\"24\"><path\x20fill=\"none\"\x20d=\"M0\x200h24v24H0V0z\"/><path\x20fill=\"#202224\"\x20d=\"M19.35\x2010.04C18.67\x206.59\x2015.64\x204\x2012\x204\x209.11\x204\x206.6\x205.64\x205.35\x208.04\x202.34\x208.36\x200\x2010.91\x200\x2014c0\x203.31\x202.69\x206\x206\x206h13c2.76\x200\x205-2.24\x205-5\x200-2.64-2.05-4.78-4.65-4.96zM19\x2018H6c-2.21\x200-4-1.79-4-4\x200-2.05\x201.53-3.76\x203.56-3.97l1.07-.11.5-.95C8.08\x207.14\x209.94\x206\x2012\x206c2.62\x200\x204.88\x201.86\x205.39\x204.43l.3\x201.5\x201.53.11c1.56.1\x202.78\x201.41\x202.78\x202.96\x200\x201.65-1.35\x203-3\x203zm-5.55-8h-2.9v3H8l4\x204\x204-4h-2.55z\"/></svg>\x0a",
 
diff --git a/internal/dl/dl.go b/internal/dl/dl.go
index 10d8b20..8636509 100644
--- a/internal/dl/dl.go
+++ b/internal/dl/dl.go
@@ -8,8 +8,9 @@
 // lists entities with sorting and filtering.
 // It is designed to run only on the instance of godoc that serves golang.org.
 //
-// The package also serves the list of downloads at:
+// The package also serves the list of downloads and individual files at:
 //     https://golang.org/dl/
+//     https://golang.org/dl/{file}
 //
 // An optional query param, mode=json, serves the list of stable release
 // downloads in JSON format:
@@ -32,9 +33,8 @@
 )
 
 const (
-	downloadBaseURL = "https://dl.google.com/go/"
-	cacheKey        = "download_list_4" // increment if listTemplateData changes
-	cacheDuration   = time.Hour
+	cacheKey      = "download_list_4" // increment if listTemplateData changes
+	cacheDuration = time.Hour
 )
 
 // File represents a file on the golang.org downloads page.
@@ -125,8 +125,12 @@
 	return false
 }
 
+// URL returns the canonical URL of the file.
 func (f File) URL() string {
-	return downloadBaseURL + f.Filename
+	// The download URL of a Go release file is /dl/{name}. It is handled by getHandler.
+	// Use a relative URL so it works for any host like golang.org and golang.google.cn.
+	// Don't shortcut to the redirect target here, we want canonical URLs to be visible. See issue 38713.
+	return "/dl/" + f.Filename
 }
 
 type Release struct {
diff --git a/internal/dl/server.go b/internal/dl/server.go
index 4ce0f6e..8b3bd7c 100644
--- a/internal/dl/server.go
+++ b/internal/dl/server.go
@@ -188,6 +188,12 @@
 		h.listHandler(w, r)
 		return
 	case fileRe.MatchString(name):
+		// This is a /dl/{file} request to download a file. It's implemented by
+		// redirecting to another host, which serves the bytes more efficiently.
+		//
+		// The redirect target is an internal implementation detail and may change
+		// if there is a good reason to do so. Last time was in CL 76971 (in 2017).
+		const downloadBaseURL = "https://dl.google.com/go/"
 		http.Redirect(w, r, downloadBaseURL+name, http.StatusFound)
 		return
 	case name == "gotip":