1
0
mirror of https://github.com/golang/go synced 2024-11-05 14:36:11 -07:00
Commit Graph

364 Commits

Author SHA1 Message Date
Brad Fitzpatrick
2a413a02cc godoc/static: let client use vet check returned by /compile endpoint
(Forked off Yury Smolsky's CL 176618)

With this change, the playground.js client now asks the server to do a
vet check in the same HTTP request as the /compile (and run) step. If
the server replies that it understands the request (VetErrors or VetOK
in the repsonse), then the client can avoid the latency of a second
HTTP roundtrip. We'll remove the /vet handler after we see it fall out
of use from older clients.

Updates golang/go#31970

Change-Id: I5b123883e19cbc6a8ec30c50705e6b945a4d322d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/176939
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-05-13 21:41:31 +00:00
Dmitri Shuralyov
bd17c084df godoc/env: replace with golangorgenv
This change replaces the env package with a new golangorgenv package.

The previous env package existed primarily to configure the godoc
instance that was running golang.org. By now, the golang.org website
has been factored out to x/website, which has its own env package,
but ends up still using this env package indirectly via x/tools/godoc.

The goal of this change is to make env available for other services
that run on subdomains of golang.org, so they can continue to safely
rely on the x/tools/playground, which will be modified in the next
commit to also use the new golangorgenv.

The golangorgenv package replaces the IsProd function with a more
specific one. Start using it in packages x/tools/{,cmd}/godoc. Also,
re-arrange the order of checks to give the host suffix check higher
priority than the environment variable check. This way, if the
environment variable isn't set, the host suffix check gets a chance
to run.

When getting the value of "X-AppEngine-Country" header, use its
canonical format "X-Appengine-Country" to avoid an allocation.
This does not change behavior.

Updates golang/go#30486

Change-Id: I97b47211a45ca0351f31fcb4fa6d408a4b0c4c7c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/165459
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-07 16:39:06 +00:00
Elias Naur
ab489119c5 cmd/godoc,cmd/gorename,refactor/rename: skip tests on GOOS=android
Change-Id: I7a493ba4c41dddb3049a8e62198d87749fb72f62
Reviewed-on: https://go-review.googlesource.com/c/tools/+/165719
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 15:27:20 +00:00
Dmitri Shuralyov
97f80cd550 godoc/dl, godoc/proxy, godoc/short, internal/memcache: delete
These packages existed only to power cmd/godoc for the purpose of
serving the golang.org website. That functionality has moved into
x/website as part of golang/go#29206. x/website has become the
canonical source of golang.org in CL 162157, the golang.org-serving
code was removed from cmd/godoc in CL 162400, and these packages can
be deleted too now.

This removes the last dependency on the cloud.google.com/go module,
which results in a significant reduction of the number of indirect
dependencies in x/tools (this is due to issue golang/go#29935, which
affects the current version of the cloud.google.com/go module).

Run go mod tidy (using Go 1.12 RC 1).

Updates golang/go#29206
Updates golang/go#29981

Change-Id: If07e3ccae8538b3ebd51af64b6af5be5463f4906
Reviewed-on: https://go-review.googlesource.com/c/162401
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Channing Kimble-Brown <channing@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-02-20 19:06:17 +00:00
Dmitri Shuralyov
9394956cfd godoc: don't clear user-set page mode for package builtin
When rendering the documentation of the fake package builtin,
there are two PageInfoMode flags that always get set,
regardless of what the user has provided via the ?m= query parameter.
They are:

• NoFiltering
• NoTypeAssoc

This is being done to make the documention of this special package more
usable and helpful (see golang/go#6645).

This change modifies the way those flags are set, so that any additional
flags the user may have set are no longer cleared. This makes it possible,
for example, to use ?m=src to view the source, as it is for all other
packages.

Also elaborate more about this behavior in the comments.

Fixes golang/go#30300
Updates golang/go#6645

Change-Id: I77728bd2683191b97d8f58f19092f2833dfc474c
Reviewed-on: https://go-review.googlesource.com/c/162983
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-19 18:51:02 +00:00
Dmitri Shuralyov
d38dac729d godoc: remove unused CLI-only identifiers
This is a followup to CL 141397, which removed CLI support from the
godoc command for golang/go#25443. This change removes a few more
CLI-related fields from Presentation type, which are now unused.

It also removes the unused and no longer documented (since CL 143077)
NoHTML PageInfoMode.

Updates golang/go#25443

Change-Id: Ia4147515052889570e2f050e3c2394689d3c5d6c
Reviewed-on: https://go-review.googlesource.com/c/162982
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
2019-02-19 18:50:39 +00:00
Agniva De Sarker
7f7074d5bc godoc: remove leading tabs while formatting text
Fixes golang/go#29568

Change-Id: Ia9e91bb4cf7a5916696268141ef5ec29e4372130
Reviewed-on: https://go-review.googlesource.com/c/160917
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-05 05:01:22 +00:00
Rebecca Stambler
bb1329dc71 godoc/static: update static.go
golang.org/cl/158137 was missing a corresponding update to static.go.

Updates golang/go#29482

Change-Id: I60e059c3f00408c0d41e5284cb3e154fc1515032
Reviewed-on: https://go-review.googlesource.com/c/160482
Reviewed-by: Katie Hockman <katie@golang.org>
2019-01-30 21:42:55 +00:00
Andrew Bonventre
9bdeaddf5f godoc/static: inherit textarea color to avoid illegible text
The cascading sylesheet from the users UI can be inverted.
If the background color is altered in the textarea and the text
style is left unchanged the text may become illegible.
The default value of the textarea color is that of the users UI
styling and is not the same as that of the document body.
Setting color: inherit; resolves this.

Fixes golang/go#29482

Change-Id: Iaa6780154e0bd01d2a8219d813468dab25331b46
GitHub-Last-Rev: 8706d7aa4e183f98144b0b958f745bab12b6ce75
GitHub-Pull-Request: golang/tools#70
Reviewed-on: https://go-review.googlesource.com/c/158137
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-01-30 19:01:28 +00:00
Dmitri Shuralyov
1c3581914d godoc/short: point to new tracking issue for shortlink creation
There's a new dedicated issue tracking this task, point to it instead
of the previous large issue which has been closed by now.

Updates golang/go#29988
Updates golang/go#27205

Change-Id: Ib1443d14a6369322b36cdf8305344a35c421a2e5
Reviewed-on: https://go-review.googlesource.com/c/160377
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-30 17:39:57 +00:00
Julie Qiu
0c44af741b godoc/dl: add julieqiu to validUser
Change-Id: I6b2a49fdae7c45b2b40865c637243402952826af
Reviewed-on: https://go-review.googlesource.com/c/159138
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-23 19:20:57 +00:00
Dmitri Shuralyov
4b7be70d8a godoc/dl: don't display unstable releases under archive
If a release is unstable, don't consider adding it to archive or stable
lists as well. It should be present in the unstable list only.

Create and use test helper list to make tests more compact and thorough.

Also use a more consistent order of got, want in TestFilesToReleases.

Fixes golang/go#29669

Change-Id: I74cf1fa8ebf05b13a3a4c40b53442c50e0427302
Reviewed-on: https://go-review.googlesource.com/c/157499
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-11 18:10:22 +00:00
Dmitri Shuralyov
aa03309574 godoc/redirect: display Gerrit/Rietveld CL disambiguation page when needed
For CL numbers that are determined to be Rietveld CLs, instead of
immediately redirecting, check whether a Gerrit CL with the same
number also exists. Do so by querying the Gerrit API and caching
the existing CLs. If both exist, display a very simple disambiguation
HTML page.

Cache Gerrit CLs that exist, to avoid querying the remote API server
more than once per CL. We can't cache Gerrit CLs that don't exist,
since they might get created in the future.

Fixes golang/go#28836

Change-Id: I08c32dc82a0136788337c5c32028e87428e8d81e
Reviewed-on: https://go-review.googlesource.com/c/157197
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-10 01:58:56 +00:00
Rebecca Stambler
7c850e7ac1 godoc/static: update copyright year in static.go
This change was created with `go generate
golang.org/x/tools/godoc/static` and updates the year in the copyright
notice in the file.

Change-Id: I5916b7a6d1f1ceae84d58c392767ca97b314ebc3
Reviewed-on: https://go-review.googlesource.com/c/156077
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-01-02 19:58:57 +00:00
Filippo Valsorda
4d6773f6fa godoc/dl: serve "go get" meta for golang.org/dl/gotip
Change-Id: I05db10e9b3f4983d23af4dc5fd4cce9b3979e9c5
Reviewed-on: https://go-review.googlesource.com/c/153097
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-12 18:30:22 +00:00
Chris Broadfoot
837e80568c godoc/proxy: remove use of httputil.ReverseProxy for /share
ReverseProxy doesn't re-set the Request's Host field, only
Request.URL.Host.
The HTTP/2 client prefers Request.Host over Request.URL.Host, so this
results in the request being sent back to the host that originally
accepted the request.
This results in an infinite redirect (and consumption of many connections to
itself).
See Issue golang/go#28168 for details.

Replace it with a simple proxy that drops all the headers (except
Content-Type).

I tried setting the proxy.Director, but it still didn't work. Could do
with some more investigation.

Fixes golang/go#28134.

Change-Id: I5051ce72a379dcacfbe8484f58f8cf7d9385024d
Reviewed-on: https://go-review.googlesource.com/c/141718
Run-TryBot: Chris Broadfoot <cbro@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-12 17:29:21 +00:00
Brad Fitzpatrick
e77c06808a godoc/redirect: improve Rietveld CL heuristic
Go's CL numbers as assigned by Gerrit have started to collide with the
lower numbers in the sparse set of CL numbers as returned by our old
code review system (Rietveld).

The old heuristic no longer works now that Gerrit CL numbers have
reached 150000.

Instead, include a map of the low Rietveld CL numbers where we might
overlap and bump the threshold heuristic up.

Updates golang/go#28836

Change-Id: Ice719ab807ce3922b885a800ac873cdbf165a8f7
Reviewed-on: https://go-review.googlesource.com/c/150057
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-11-16 19:35:47 +00:00
Hana Kim
40a48ad93f godoc: replace x/net/context with context
Change-Id: I5b0508ccf7a912a8f334abcfb32033e120fc7971
Reviewed-on: https://go-review.googlesource.com/c/143717
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-23 01:05:39 +00:00
Agniva De Sarker
3e7aa9e599 godoc: generate TOC from server-side for search page
Currently, we generate the TOC for a page dynamically after page load
through javascript. This is fine for pages with static content.

But for pages with dynamic output like /search, sometimes this causes a
noticeable page jump due to extensive DOM traversal. Also, the heuristics
to calculate the no. of columns is very rudimentary and fills the entire
above-the-fold area if the no. of results is very large.

Therefore, we generate the TOC from server side itself. And improve
the no. of columns heuristic further to accomodate up to 4 columns.

This improves page performance and utilizes real estate appropriately
according to the input.

Some screenshots at laptop (1366x768) resolution.
https://snag.gy/AXz2rP.jpg
https://snag.gy/th3Nn8.jpg

More can be found in the CL comments.

Fixes golang/go#21685
Updates golang/go#21686

Change-Id: Ia9b6dd1e67231d992709e4ba10ebdbedfe38b564
Reviewed-on: https://go-review.googlesource.com/c/129135
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-19 20:12:13 +00:00
Agniva De Sarker
def2677374 cmd/godoc: cleanup documentation for CLI mode
- Removed all documentation which referred to godoc's CLI capabilities.
- Added some missing flags which were not documented.
- Removed some redundant mentions of "web server" because now it is
just a web server.
- Converted some links to https

Change-Id: I7ddcf417d2bc3df13183adcfd0f82af9a37a1b91
Reviewed-on: https://go-review.googlesource.com/c/143077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-18 18:24:39 +00:00
Yury Smolsky
321fe744f3 playground.js: make output of "Run" clearer
This CL changes the last line displayed after the program was run
to display more details on what happened.

If the program cannot be built,
the last message is "Go build failed".

If the program has tests,
the last message is "All tests passed" in case of success.
Otherwise it is "N tests failed".

If the program has exited with non-zero code,
the exit message is postfixed with the code.

This CL adds output for timed out programs.

This CL is prerequisite for the backend change in CL 141478.
Dockerfile in playground repo has to be updated to include this CL.

Updates golang/go#10590
Updates golang/go#25454

Change-Id: Ie0a51b0729c574d2508a4a1b89f629def1d79fd6
Reviewed-on: https://go-review.googlesource.com/c/141477
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-10-16 19:24:31 +00:00
Agniva De Sarker
4fd3307906 godoc: fix inline playground width for mobile devices
The inline playground had a fixed width due to which it gets partially
hidden on mobile devices. Hence, expanding the div to fit the entire
screen properly inside the media query for mobile resolutions.

Also, since the playground appears on top of the button, there is
no way to hide it except to reload the page. So, added a click handler
on the page to hide the playground if it is open.

Fixes golang/go#21636

Change-Id: Id15caec25e870e9ff3be7736e2bb1084591d1016
Reviewed-on: https://go-review.googlesource.com/c/129435
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-16 15:29:12 +00:00
Agniva De Sarker
c75e7e6983 godoc: inject treeview content only when needed
- This shaves off 12.8KB (unzipped) / 3.8KB (zipped)
downloadable data and around 6ms of javascript parse time
when the files are not injected.

- Also, conditionally rendering the callgraph html only when
callgraph is actually present.

- Removed the "text/javascript" attribute as it is the default
value now.

Change-Id: I70c030bdda2a054c181b2b3a693842bafed88d1a
Reviewed-on: https://go-review.googlesource.com/c/115875
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 02:39:00 +00:00
Kunpei Sakai
48cd23a0c8 godoc/static: get rid of ::-webkit-search-decoration of #search
The input[type="search"] has a pseudo element,
it's ::-webkit-search-decoration and has an original margin.

To get rid of the margin, this commit specifies -webkit-appearance
property to none.

Fixes golang/go#27210

Change-Id: I09bbae5e0b811a3b3fa3a047b97ea45190e75f46
Reviewed-on: https://go-review.googlesource.com/c/131317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 02:36:07 +00:00
Brad Fitzpatrick
e5fe289229 godoc, cmd/godoc: remove CLI support
godoc is now just a webserver (the one that runs golang.org)

A future change might rename this to something else, but not now.

Fixes golang/go#25443

Change-Id: Ib95d0589e13f4c7a717ff28d694f1472e427eef4
Reviewed-on: https://go-review.googlesource.com/c/141397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-10-11 02:31:40 +00:00
Andrew Gerrand
0e57ebad1d godoc/static: prevent menu "bouncing" when showing Play button
The code as written would use JavaScript to show the "Play" button in
the menu when the Playground is enabled, making the button appear
after the page first renders, causing a visible "bounce" in the menu.
This change checks the condition (whether this is not the front page, or
"wide") in the template code, instead of with JavaScript after the page
has loaded.

Change-Id: Iccf0a344116372f3207158793be8c7734e67a4ae
Reviewed-on: https://go-review.googlesource.com/c/140798
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-10-11 02:11:41 +00:00
Brad Fitzpatrick
cd09f19c2f godoc: move third-party godoc deps behind build tag
Fixes golang/go#27970

Change-Id: I6de10c260f31721bf83073ef5b140442c3ef7eb0
Reviewed-on: https://go-review.googlesource.com/c/139197
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2018-10-02 22:38:33 +00:00
Chris Broadfoot
008d18139c godoc/static: regenerate
I must have forgotten to re-generate after rebasing from upstream.

Change-Id: I3465cd4cce9f4b6fd6e94fc51dc42b5efd11052b
Reviewed-on: https://go-review.googlesource.com/138977
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-10-02 04:53:32 +00:00
Chris Broadfoot
ee6b03148c godoc: migrate to App Engine flexible
See bug for more details on exactly what was migrated.

Notably:
* No more Google-internal deployment scripts; see README.godoc-app and
  the Makefile for details.
* Build tag "golangorg" is used for the godoc configuration used for
  golang.org.
* Use of App Engine libraries replaced with GCP client libraries.
* Redis is used to replace App Engine memcache.
* Google analytics is controlled by an environment variable.
* Regression tests have been migrated from Google-internal.
* hg -> git hash map is moved from Google-internal.

Updates golang/go#27205.

Change-Id: Ia0a983f239c50eda8be2363494c8b784f60c2c6d
Reviewed-on: https://go-review.googlesource.com/133355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-02 04:34:10 +00:00
Dmitri Shuralyov
b71db7f417 godoc/dl: add dmitshur, katiehockman to binary upload whitelist
This is for uploading Go release binaries to dl.google.com with
x/build/cmd/release.

Updates golang/go#27953.

Change-Id: Idc9e5d5c4cf4c1e5602b51cc1159c982038c7901
Reviewed-on: https://go-review.googlesource.com/138879
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2018-10-01 22:23:27 +00:00
Agniva De Sarker
ae8529dc16 godoc/vfs/zipfs: join paths to get correct RootType
The logic was incorrectly written from vfs/os.go. zipfs filesystem
passes actual paths during dirTree building. So we need to join the paths
to determine whether they are under GOROOT or GOPATH.

Updates golang/go#27205

Change-Id: Ic4330fce02c6ebfc44ae21122e2412c33f0cd45a
Reviewed-on: https://go-review.googlesource.com/138435
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-28 16:24:37 +00:00
Kevin Burke
4bc20fc791 godoc: fix indenting on Firefox
See comment in the patch for an explanation, Firefox (specifically
with the Menlo font) does not like tabs beginning in column 9, so we
start it in column 10.

Updates webcompat/web-bugs#17530
Fixes golang/go#26316
Fixes golang/go#23500

Change-Id: I4c96118b8c3b13ee1fd21ce85bd7c681e99a4b4f
Reviewed-on: https://go-review.googlesource.com/131716
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-08-30 21:44:40 +00:00
Brad Fitzpatrick
f6ba574295 godoc/dl: update Mac & Windows minimum versions
Updates golang/go#27213

Change-Id: I25813e9aafcdb39d4f93e27b98d8672c770234a6
Reviewed-on: https://go-review.googlesource.com/131402
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-08-26 00:09:51 +00:00
Agniva De Sarker
b776bcbf45 godoc/vfs: improve comment on GOROOT
GOROOT is not a function, so use "is" instead of "returns".
This was originally raised during review of golang.org/cl/131315.

Also add a missing period.

Change-Id: Ie28d38529889702ae5035d0f48d8122b6bee6819
Reviewed-on: https://go-review.googlesource.com/131316
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-08-26 00:05:47 +00:00
Agniva De Sarker
6c1c5e93cd godoc/vfs: reorder comment paras to display the correct one
This is a fixup for golang.org/cl/130796.

Change-Id: If151325738b59ab61a7b456a140d3bc8dff57b9c
Reviewed-on: https://go-review.googlesource.com/131315
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-08-24 17:52:16 +00:00
Agniva De Sarker
ba93f9405e godoc: update to use new goroot finding logic
The logic to determine whether a filesystem root was in GOROOT or GOPATH
still relied on runtime.GOROOT(), whereas cmd/godoc was updated to copy
the goroot finding logic from standard library.

Hence, godoc is unable to determine if a filesystem is in GOROOT or not
when the binary is outside runtime.GOROOT(). So we expose a new variable
and set that from cmd/godoc to avoid copying the logic again for the 3rd time.

Fixes golang/go#27162

Change-Id: I160dcdbdd262e671f09f7bf01c329be5eac280ad
Reviewed-on: https://go-review.googlesource.com/130796
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-23 15:26:32 +00:00
Kazuhiro Sera
4354ead92e all: fix typos in comments
This pull request fixes several typos in comments. I believe that they're safe enough.

Change-Id: Ic7c594bdb89dcd04f8775f225abbc0f966f3728e
GitHub-Last-Rev: 2394feb263714c83b419f45eccb3c6c9fdff7fed
GitHub-Pull-Request: golang/tools#45
Reviewed-on: https://go-review.googlesource.com/128956
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-10 18:15:57 +00:00
Russ Cox
ad8705d9f6 godoc/redirect: redirect design docs to Gerrit, not GitHub
Gerrit's rendering is cleaner and Gerrit is the source of truth anyway.

Fixes golang/go#26871.

Change-Id: I0bf69d174662c7acc083b03b009bac92f781a17c
Reviewed-on: https://go-review.googlesource.com/128596
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-08-08 21:07:32 +00:00
Mostyn Bramley-Moore
9e9f7f69ec godoc: skip build tag annotations when displaying examples
After moving the filepath.Walk example to a standalone example file
in CL 122237 (so it could use a standalone function), godoc includes
the build tag annotation ("// +build !windows,!plan9" in this case)
in the runnable example.  The example runs correctly, but the
annotation might be confusing for new users.

Change the behavior so that godoc skips these annotations when
displaying examples.

To avoid false positives in older versions of "go vet", which are still used
on the build dashboard, we avoid using a multiline string in the test.

Fixes golang/go#26490.

Change-Id: I1da4b3b7e1e5a85a76773e25d9355b3f92479c19
GitHub-Last-Rev: bc5ed29bd368e5bcf11fed7a0c7f14b872fef065
GitHub-Pull-Request: golang/tools#42
Reviewed-on: https://go-review.googlesource.com/126256
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-31 18:38:43 +00:00
Andrew Bonventre
0700b576e4 godoc: don't display tar instructions for malformed download query
Ensure that the filename passed via ?download= matches the given
regexp before showing the command-line instructions to download it.

Change-Id: Ieb7c6912409474f31637ff1193fd195eb9f172b3
Reviewed-on: https://go-review.googlesource.com/126717
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-07-30 21:13:59 +00:00
Andrew Bonventre
bfb5194568 Revert "godoc: skip build tag annotations when displaying examples"
This reverts commit faa8a71ab5.

Reason for revert: +build tag in test causes build to fail :(

Change-Id: I8942a6dcc29faaceada23b63ba80ea881b3b2ca6
Reviewed-on: https://go-review.googlesource.com/126195
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-26 21:04:03 +00:00
Mostyn Bramley-Moore
faa8a71ab5 godoc: skip build tag annotations when displaying examples
After moving the filepath.Walk example to a standalone example file
in CL 122237 (so it could use a standalone function), godoc includes
the build tag annotation ("// +build !windows,!plan9" in this case)
in the runnable example.  The example runs correctly, but the
annotation might be confusing for new users.

With this change, godoc skips these annotations when displaying examples.

Fixes golang/go#26490.

Change-Id: Ice3d6a2ce4db5b5176c9c6fcabc01b69c323016d
GitHub-Last-Rev: 52beabd3d2a9cb9a556bfa3bd998a2e31ac96960
GitHub-Pull-Request: golang/tools#40
Reviewed-on: https://go-review.googlesource.com/125040
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-26 20:38:08 +00:00
Brad Fitzpatrick
65cc56d756 godoc: fix tests on Go 1.9
Updates golang/go#11811
Updates golang/go#26531

Change-Id: I9cc7daf551b76c3f06b9dd827c5733513c06895e
Reviewed-on: https://go-review.googlesource.com/125816
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-25 19:11:30 +00:00
Gustav Westling
60ffea201e godoc: correctly parse packages with digits in the package name
Fixes golang/go#26514

Change-Id: I4540737425c225c0f0c6104b5b3524621d2b0c6f
GitHub-Last-Rev: 9d5fefb6ed31579b723293c7f43fcf677ac4cddb
GitHub-Pull-Request: golang/tools#41
Reviewed-on: https://go-review.googlesource.com/125335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-07-22 15:00:05 +00:00
Brad Fitzpatrick
99195f4d4f godoc/dl: also serve go-import meta tags at golang.org/dl for cmd/go
Updates golang/go#23223

Change-Id: Iacecbb5e095fd3d6acb3f8e1fb238db63d1e0b6d
Reviewed-on: https://go-review.googlesource.com/125195
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-20 05:57:21 +00:00
Brad Fitzpatrick
827f47db85 godoc/dl: add meta tags for go get golang.org/dl/go1.N
Updates golang/go#23223

Change-Id: I628cea181d3a0e6bb25fdd98e098581aa222e049
Reviewed-on: https://go-review.googlesource.com/123679
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-20 03:34:01 +00:00
Andrew Bonventre
42aedba1e0 godoc/dl: update download link from /x/build/version to /dl
Change-Id: Id2baaa87ab23e27ce5018271c8bb4e73750fb437
Reviewed-on: https://go-review.googlesource.com/125137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-20 03:31:16 +00:00
Brad Fitzpatrick
32950ab3be godoc: add version info for struct fields
Follow-up to CL 85396, which only did types, funcs, and methods.

This adds version info to struct fields (in the form of small
comments) if the struct field's version is different from the struct
itself, to minimize how often this fires.

Updates golang/go#5778

Change-Id: I34d60326cbef88c108d5c4ca487eeb98b039b16e
Reviewed-on: https://go-review.googlesource.com/124495
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Devon O'Dell <dhobsd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-17 23:22:00 +00:00
Devon H. O'Dell
57f659e14d godoc: show version information for stdlib
This change reads $GOROOT/api/go1.*.txt when godoc starts and caches
information about which versions of Go introduce functions, types, and
methods. This information is displayed currently only in HTML output.
Functions, types, and methods introduced as part of Go 1 are not
annotated, as their presence at that version is implied.

This change does not address constants or variables, and completely
ignores the syscall package. The former are future work, the latter is
likely an exercise in futility. In all cases, this is because the story
around displaying the version information is not well developed.

Fixes golang/go#5778

Change-Id: Ieb3cc0da7b18e195bc9c443f14fd8a82e8b2bbf8
Reviewed-on: https://go-review.googlesource.com/85396
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Devon O'Dell <dhobsd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-17 18:09:30 +00:00
Brad Fitzpatrick
1c99e1239a godoc: default to GOOS/GOARCH js/wasm when rendering syscall/js docs
Otherwise it was just blank. With this CL, this URL should start rendering docs:

   https://tip.golang.org/pkg/syscall/js/

Tested locally.

Change-Id: I2d9b7286f374e9372be372987bb5d12ce5044ce9
Reviewed-on: https://go-review.googlesource.com/121315
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-28 16:39:57 +00:00