1
0
mirror of https://github.com/golang/go synced 2024-09-30 20:28:32 -06:00
Commit Graph

316 Commits

Author SHA1 Message Date
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
Agniva De Sarker
3c1bb8b785 godoc: accept scanner.RawString too during EBNF parsing
Commit c8915a0696 changed the text/scanner
package to return a scanner.RawString (rather than a scanner.String) token
for raw string literals. This broke the EBNF parser which didn't look
for scanner.RawString.

Updated the EBNF parser code to reflect that change.

Fixes golang/go#25986

Change-Id: Ib9c133a7c357dd750a4038d2ed39be86a245995c
Reviewed-on: https://go-review.googlesource.com/120659
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-06-25 04:25:21 +00:00
Alan Donovan
53440098a4 godoc/static: resolve merge conflict, committed in error
Change-Id: Ica50edbae03eb1c6efad702841b926ffaf1c98ec
Reviewed-on: https://go-review.googlesource.com/119476
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-06-18 17:10:13 +00:00
Alan Donovan
e10d6c9a84 godoc/static: use a stable quote function
Printf(%q) aka strconv.AppendQuote depends on the Unicode tables du
jour, which means gen_test breaks after a Go release in which Unicode
evolves. This change uses a very dumb quotation function that emits
only ASCII and is independent of the Go release.

Perhaps an even better fix would have been to parse the generated file.

Change-Id: I197942f1c36a8b53d6a37be4bb2b1e63a208f7e2
Reviewed-on: https://go-review.googlesource.com/119157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-18 16:36:09 +00:00
Agniva De Sarker
465e6f3992 godoc: add link to expand/close all examples
Fixes golang/go#3081

Change-Id: I096b22691a08d72b88dbe925e17893d24ba3c992
Reviewed-on: https://go-review.googlesource.com/118935
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-15 19:57:36 +00:00
Alan Donovan
903a227b9b godoc/static: mimic the pre-1.10 behavior of strconv.Quote
Thanks to iant for identifying the root cause.

Tested with go1.9 and go1.10.

Fixes golang/go#25880

Change-Id: Ibc3a2aadd92c1e512cf6c537134ee085398e8e6c
Reviewed-on: https://go-review.googlesource.com/118955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 19:21:16 +00:00
Alan Donovan
49ce10d933 godoc/static: suppress gen_test on go1.9
Either string quotation or Go formatting has since changed.
Will investigate later, but this fixes the dashboard for now.

Change-Id: Ieab3800fc2c24ba86026d25dea12853131c04948
Reviewed-on: https://go-review.googlesource.com/118715
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-06-14 18:36:27 +00:00
Andy Lindeman
e1f909067f godoc: correct abspath when looking for cmds
godoc is erroneously detecting paths like syscall and unsafe as possible
commands.

A previous attempt at a fix adjusted the parameters of pkgHandler in
pres.go, but that change had unexpected ripple effects that broke links
and other features of godoc. This change is scoped only to the godoc
command line tool.

cmdline_test.go is updated to match the parameters used in the real
pkgHandler in pres.go.

Fixes golang/go#14447

Change-Id: I8f740c6847e46523b8443722b16942192bdf9cb8
GitHub-Last-Rev: cfc24f2d4c3519c4c87628b2021f65a4725cda6b
GitHub-Pull-Request: golang/tools#27
Reviewed-on: https://go-review.googlesource.com/96515
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 15:42:59 +00:00
Robert Griesemer
02fcd6aaf1 godoc: fix test failure
Adjust code to satisfy vet.

Change-Id: I532b4d988eb29b413520de60b8520d9e100b42c9
Reviewed-on: https://go-review.googlesource.com/118557
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13 15:25:43 +00:00
Filippo Valsorda
4e38c85762 godoc/dl: add valsorda to users allowed to upload
Change-Id: Iac4a80b030be9c275323a27d2dfba4f83942cbf9
Reviewed-on: https://go-review.googlesource.com/117195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-07 18:59:51 +00:00
Yury Smolsky
a5b4c53f6e playground.js: display vet errors when program has no output
When program has no output and vet errors are encountered,
initialize data.Events as an empty array.

Fixes golang/go#25455.

Change-Id: Icedd77685b784505da3bb6383629cdfa8b8b22e9
Reviewed-on: https://go-review.googlesource.com/113875
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-25 02:41:13 +00:00
Yury Smolsky
48418e5732 godoc: display "go vet" errors before the output of a program
This change adds an option to run "go vet" for the playground program
and display errors before any output. To enable this, the playground
function has to be supplied with opts.enableVet set to true.
Vet check is performed only for succesfully run programs,
meaning that the "/compile" endpoint returned no errors.

This change highlights lines printed to stderr as errors (in red).

There is a corresponding change for the Playground: CL 100776.

Updates golang/go#7597
Updates golang/go#24576

Change-Id: I8c0f8c1189c461338b5bce57777b12aecab268fb
Reviewed-on: https://go-review.googlesource.com/107455
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-08 19:22:17 +00:00
jimmyfrasche
76f5b51ce4 x/tools/godoc: make front page video respond to layout changes (2/2)
This part of a multi-repo change. See CL 108677 for details.

Note: this change also requires a CL to golang/go to complete the fix,
though either CL without the other is harmless.

Updates golang/go#24997.

Change-Id: I99ca9a4e6df16347b8706f24cef9689b3345854a
Reviewed-on: https://go-review.googlesource.com/108678
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-08 19:21:29 +00:00
Agniva De Sarker
ae8027637c godoc/static: add test for static.go file generation
Moved the code which generates static.go to remain in the static package.
This makes the code testable.

Additionally, it is very easy for developers to forget to run "go generate"
to update static.go. Because while development, the templates directory
can be directly passed as a flag to read the files from it.

This test catches that.

Change-Id: I314907b98907bb14e4eabfd3c532ba2d84ce7c5f
Reviewed-on: https://go-review.googlesource.com/110158
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-05-03 19:34:25 +00:00
Jeevanandam M
f4ce24f1d8 godoc/static: cleanup unused lines in makestatic.go
Change-Id: I9b930efb5efd4b32c41c40d2399e04bacd75b470
GitHub-Last-Rev: 53db7899927e5ae255310c6a765526a10552649f
GitHub-Pull-Request: golang/tools#36
Reviewed-on: https://go-review.googlesource.com/111155
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-03 05:28:33 +00:00
Agniva De Sarker
a25dedfa53 godoc: set the GOROOT path properly in cmdline mode
- Setting the GOROOT build path to the value passed from the command line.

- Clarified the return values to named parameters for extra clarity.

- And while here, added some missed out error handling. Just logging the error
to preserve original behavior.

Fixes golang/go#13296

Change-Id: I91427eee790928a3cfb51ae207747e9a17bd5496
Reviewed-on: https://go-review.googlesource.com/110275
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-05-02 17:46:13 +00:00
Andrew Bonventre
c47212f6f0 godoc: don't exclude version field from File struct
When uploading a new release, it deserializes the payload into
a File struct for processing. It needs the Version field to
determine which release it's in.

Change-Id: I171f416dbb1b1b6c354948ea9a31b9c8694f892e
Reviewed-on: https://go-review.googlesource.com/110627
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-05-01 16:35:01 +00:00
Agniva De Sarker
8e070db38e godoc: remove vendor prefixes for border-radius
All major browsers support the border-radius directive
without any vendor prefix. Hence, removing them.

https://caniuse.com/#search=border-radius

Change-Id: I2da5f109296df3c7f191df95876bd6849f51d9ae
Reviewed-on: https://go-review.googlesource.com/110155
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-28 22:29:17 +00:00
Agniva De Sarker
0b5ca0b040 godoc: use relative css unit
To scale the website elements independently of the default font size,
we use the css rem unit. This scales the elements proportionally if the
user has set a different font size than the default.

We make all calculations assuming that 1rem=16px, which is the
default font size for browsers.

Tested manually on FF 59 and Chrome 65 with permutations of different
resolutions and different default font-sizes upto 36px.

Fixes golang/go#6150

Change-Id: I7ded227ee2c55178271667009ab98ee0b4e7e8b3
Reviewed-on: https://go-review.googlesource.com/94935
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-27 00:46:46 +00:00
Agniva De Sarker
1a83a0b548 godoc: fix counting of package files in GetPageInfo
CL 107155 introduced this bug due to oversight. There can be
a scenario where a folder has no source .go or .c files,
but has an ignored .go file. In that case, both the if conditions
to check the length of pkgfiles slice will evaluate to true.

Added a test case for it to prevent this happening in future.

Change-Id: I7181699bbf7580888a6f7923c5aeb842356941a8
Reviewed-on: https://go-review.googlesource.com/107195
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-16 18:17:07 +00:00
Kevin Burke
d9caac3737 godoc: add benchmark for directory scan
I'd like to propose changes to the directory scanner implementation,
and it would be good to be able to measure how changes compare in
terms of allocations and time taken.

Change-Id: I4ff4bbd38b5e3522f50d31473f2ac607bb0de802
Reviewed-on: https://go-review.googlesource.com/94904
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-15 15:36:21 +00:00
Agniva De Sarker
327197e6b0 godoc,blog: perform minor cleanup
- Remove a stray comment which was no longer needed. The accompanying
issue golang.org/issue/7524 was discussed and closed.
- Combine 2 if conditions into a single if-else because
length of a slice can never be negative.
- Remove http links from golangOrgAbsLinkReplacer now that all
links have been changed to https in the blog articles.

Change-Id: I2fe2ec245b580a91760c9331e9626b367f1b6740
Reviewed-on: https://go-review.googlesource.com/107155
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-14 19:30:04 +00:00
Agniva De Sarker
8b3cccae50 godoc/vfs: improve implementation of RootType
- Removed the StandAlone and Asset root types as they were just there
for other vfses to satisfy the FileSystem interface and causing unnecessary
confusion. Returning just empty strings in those scenarios now to clarify
that it is a dummy placeholder.

- Removed the prefix "Fs" from RootType as it was unnecessary.

- Using the RootType type to pass down to the html templates
instead of converting to string. The templates are capable of converting
to the actual string representation when comparing the value.

Change-Id: Iadc039f1354ecd814eec0af1e52cdbaaeff0cc89
Reviewed-on: https://go-review.googlesource.com/106196
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-11 20:41:25 +00:00
Agniva De Sarker
faed997d2c godoc: cleanup package templates
Separate the templates of package root directory and other
directories. This removes several if-else conditions and
makes the template code much cleaner.

To be merged after CL 95835.

For golang/go#3305

Change-Id: I435441dbe214e4c89271483173df7c30a42ee28f
Reviewed-on: https://go-review.googlesource.com/101295
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-10 16:42:09 +00:00
Agniva De Sarker
16d1af8d88 godoc: group package home page list by root
This CL groups the package list into two groups - standard library(GOROOT),
and third-party code(GOPATH).

It also wraps the list with a collapsible div header used in the package
documentation page. This makes the entire page easy to view and manage, and also
makes it consistent with the rest of the pages.

To implement this, a new function was added to the filesystem interface
which returns the root type of the filesystem. In most cases, it is either GOROOT
or GOPATH. There are other kinds of filesystems which are not used in the home page,
so additional values have been added to satisfy the interface.

A side effect of this is that the html template code has become a bit spaghetti-like
with if conditions all over. This is because the same template is used to render
a package directory as well as the package home page. A better way is to use
two separate templates for the different tasks. This cleans out a lot of the
if conditions and make for a much cleaner code. This has been taken care in CL 101295.

Fixes golang/go#3305
Fixes golang/go#15020

Change-Id: I876357dc76280a7df2ed08d7c6bc53d9a41e69ab
Reviewed-on: https://go-review.googlesource.com/95835
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-10 16:41:40 +00:00
Agniva De Sarker
ac136b6c2d godoc: sort package listing
The directory slice gets created first from newDirTree and then
gets appended again after reading from the dirchs channel. Hence
we need to sort the slice after all the entries are added.

Fixes golang/go#24601

Change-Id: I9282e8643a4448b2c1c84495b7642610f6c56d50
Reviewed-on: https://go-review.googlesource.com/103955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Kevin Burke <kev@inburke.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-01 16:57:15 +00:00
Dmitri Shuralyov
370143dbca godoc/static: add perf, review, sync subrepos
They exist and are considered to be worth listing based on the decision
made in golang/go#24432. They weren't listed previously. This change
fixes that.

Document the remaining subrepos that are not meant to be listed (per
decision in golang/go#24432), so it's clear that it's intentional for
them to not be visible at https://golang.org/pkg/#subrepo.

Closes golang/go#24432.
Updates golang/go#14304.

Change-Id: Icc50ebfcdbc490c32519d92a1a838eb3f54c823d
Reviewed-on: https://go-review.googlesource.com/103075
Reviewed-by: Austin Clements <austin@google.com>
2018-03-30 16:45:20 +00:00
Yury Smolsky
4c0f0e48a6 godoc: add vet support to playground.js
Playground needs godoc to support calls to /vet endpoint in playground.js.
Optional parameter "vetEl" is added to the function "playground".
If it's passed then the js installs the click handler to the element.

There is a corresponding CL 100776 for the playground code.

Updates golang/go#7597

Change-Id: Ica2e7cb9d76f6f19a1805c182e666b8142762da9
Reviewed-on: https://go-review.googlesource.com/100775
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-23 17:42:02 +00:00
Kevin Burke
96caea4103 godoc: fix runaway goroutine use
Previously we would spin up a new goroutine for every directory
we needed to parse. Since parent directories cannot exit until
children have exited, in large GOPATH directories we could have 8000+
goroutines evaluating directories concurrently. The race detector uses
tsan, and tsan can handle a maximum of 8192 concurrent threads at one
time.

Limit the number of concurrent threads. It is difficult to do this
in a way that does not involve a child being blocked on a parent
completing to spin up goroutines for itself to complete. Solve this by
completing work on the main thread if there are no additional workers
available to help complete work.

I was expecting limiting the concurrency to hurt performance, but it
actually significantly improves it. Benchmarks were performed using CL
94904 at tip, and with goroutines at 2, 4, and 8 times the number of
CPU's.

$ benchstat tip.benchmark gated-2.benchmark gated-4.benchmark gated-8.benchmark
name \ time/op    tip.benchmark  gated-2.benchmark  gated-4.benchmark  gated-8.benchmark
NewDirectory-4       293ms ± 2%         262ms ± 4%         252ms ± 4%         253ms ± 2%

name \ alloc/op   tip.benchmark  gated-2.benchmark  gated-4.benchmark  gated-8.benchmark
NewDirectory-4       218MB ± 0%         218MB ± 0%         218MB ± 0%         218MB ± 0%

name \ allocs/op  tip.benchmark  gated-2.benchmark  gated-4.benchmark  gated-8.benchmark
NewDirectory-4        513k ± 0%          508k ± 0%          509k ± 0%          510k ± 0%

Fixes golang/go#22110.

Change-Id: If01f78f1fc53cd195e4f8f6988c3c39b3c275992
Reviewed-on: https://go-review.googlesource.com/94955
Reviewed-by: Yury Smolsky <yury@smolsky.by>
Reviewed-by: Kevin Burke <kev@inburke.com>
2018-03-18 01:21:57 +00:00
Dmitri Shuralyov
14b3f5b193 godoc/static: add x/time subrepo
It exists, but wasn't listed previously. This change fixes that.

Fixes golang/go#24430.

Change-Id: Iaf83a4b7353794e6f411941de811ed1554955179
Reviewed-on: https://go-review.googlesource.com/101241
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-17 16:38:46 +00:00
Yury Smolsky
39919aea04 cmd/godoc: provide -all flag to output unexported identifiers
This flag includes unexported identifiers in command-line mode.
It is equivalent to ?m=all in web mode.

Fixes golang/go#8093

Change-Id: I1e5a69626929d3430638d900f3e975b272a98c90
Reviewed-on: https://go-review.googlesource.com/99435
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-16 16:52:36 +00:00
Agniva De Sarker
5ad4d95e58 godoc: add the defer attribute to script tags
This allows the scripts to be downloaded concurrently as the
body is being parsed.

Deferred scripts are executed in order and only after the entire
document has been loaded. So essentially the entire effect remains same
but we reduce the network download time.

Also, CL 90396 missed out updating static.go. Packaging the change along
with this.

Change-Id: Ia850bd50b49f2a9e0e4fbc29617858ab0fa8a0b9
Reviewed-on: https://go-review.googlesource.com/100295
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-03-15 17:24:39 +00:00
peter zhang
10db2d12cf cmd/present: support being reverse proxied from https
Fixes golang/go#21921

Change-Id: Idc6ff2773dcef7210ce4d0eecb7affb357a213b5
GitHub-Last-Rev: 50b959e9b6f2f1513235c5ca0124d80b487c5296
GitHub-Pull-Request: golang/tools#26
Reviewed-on: https://go-review.googlesource.com/96295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-26 18:43:58 +00:00
Agniva De Sarker
2ae76fd156 godoc: show synopses for subdirectories in package view
In command-line mode, we were traversing the dir tree with depth
of only 1. This prevented the synopses of sub-directories from being
scanned and showed in the output when a package path was being passed.

Increasing the depth to 2 so that sub-directories of the next
level is also parsed and the synopses gets shown.

Also fixed the comment to reflect that dir can be nil only in
command-line mode now after golang.org/cl/93215

Fixes golang/go#22646

Change-Id: I066a3bc3ba3d9d3a9589f97137e1bc4497a45473
Reviewed-on: https://go-review.googlesource.com/93675
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-23 18:19:23 +00:00
Zachary Gershman
86e0f6745d godoc/dl: provide JSON feed of releases
This addresses the build errors that caused a
revert of the original PR golang/tools#21

Fixes golang/go#23746

GitHub-Last-Rev: 6606c0b63afb4f1043b2aa2dc640edda4cf9afe8
GitHub-Pull-Request: golang/tools#25
Change-Id: Ic5a7e3054d182dc2041d2966ca68960c3abd7620
Reviewed-on: https://go-review.googlesource.com/96178
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-23 16:36:39 +00:00
Brad Fitzpatrick
f8f2f88271 Revert "godoc/dl: provide JSON feed of releases"
This reverts commit 07fd8470d6.

Reason for revert: doesn't compile; was never tested apparently.

Change-Id: I9502dbd3fae1f388ee48d6de9a3f2c1df53411ad
Reviewed-on: https://go-review.googlesource.com/96235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-22 03:58:06 +00:00
Zachary Gershman
07fd8470d6 godoc/dl: provide JSON feed of releases
Fixes golang/go#23746

GitHub-Last-Rev: a188d86ac3d63756dbf8b46bca29d003f33bfa27
GitHub-Pull-Request: golang/tools#21
Change-Id: I0ca504081b239cd3cd8f7c1aed205807b5279d2b
Reviewed-on: https://go-review.googlesource.com/93080
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-21 16:48:45 +00:00
Brad Fitzpatrick
45c8140d10 Revert "godoc: correct fsRoot to prevent misleading message about cmd/"
This reverts commit db9df82880.

Reason for revert: Broke the build. I forgot to run tests, sorry.

Change-Id: I8a6ef88cac2aa638982530960f0d37a32dc5ccf0
Reviewed-on: https://go-review.googlesource.com/95875
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-21 16:38:00 +00:00
Andy Lindeman
db9df82880 godoc: correct fsRoot to prevent misleading message about cmd/
Fixes golang/go#14447

GitHub-Last-Rev: 98ea70ca4df4e1bdead0b3960ef0381b4f81572b
GitHub-Pull-Request: golang/tools#24
Change-Id: Ida7db414a47ea6f6da5de400bcb6a5aea03f1d05
Reviewed-on: https://go-review.googlesource.com/94841
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-21 03:28:22 +00:00
Agniva De Sarker
ce871d1788 godoc: allow line numbers to be searched by ctrl+f
We used a css-pseudo class rule to move the line number inside
the pseudo element. The idea was to prevent line numbers from getting
selected while copying the code. But this was already implemented
with the "user-select: none" rule.

Since the spec was undefined on "user-select", we had to resort
to the pseudo-class, but now both FF and Chrome implement the correct
behavior.

Hence, moving the content to be inside the span, and removing the
pseudo-class rule.

Manually tested with Chrome 63 and Firefox 58 on Ubuntu.

Fixes golang/go#23724

Change-Id: I3e733db766b44875ba6bc3f6985cde2559d116e2
Reviewed-on: https://go-review.googlesource.com/93975
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-15 02:55:20 +00:00
Agniva De Sarker
7374a09fcc godoc: move package example section
The example_html was being rendered outside the ".expanded" div which
did not hide it when the parent Overview div was being hidden. Moving it
inside the div so that the behavior is consistent

Fixes golang/go#23590

Change-Id: I75ee0af1c4074e02629b84ce366b34711e6d823b
Reviewed-on: https://go-review.googlesource.com/90396
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-14 17:36:17 +00:00
Agniva De Sarker
006ac430a0 godoc: init corpus in a separate goroutine in http mode
Currently, in http mode the server blocks until the corpus
has been initialized. This can cause considerable delay
if the user workspace is significantly large and the files
are not present in the buffer cache.

This CL spawns off the initialization in a separate goroutine
if httpMode is set and turns on a flag when it's done.
The http handler checks the flag and returns an error response
if it has not been set.

The check is only performed for the path prefixes handled by the
handlerServer struct. Other paths do not call the GetPageInfo() function
and hence can return immediately. This preserves maximum responsiveness
of the server.

Also adds an additional print statement in verbose mode

Note: This is a re-do of a previous CL golang.org/cl/88695 which was
incorrect committed without running tests. This CL fixes that test.

Fixes golang/go#13278

Change-Id: I80c801f32af007312090d3783a2ea2c6f92cad66
Reviewed-on: https://go-review.googlesource.com/93215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-13 20:23:58 +00:00
Andrew Bonventre
70252dea49 Revert "godoc: init corpus in a separate goroutine in http mode"
This reverts commit f86b507a7e.

Reason for revert: broke tests in tools repo

Change-Id: Id7e5d8e050896b6f5fedaee705be8a5f9adf4bf3
Reviewed-on: https://go-review.googlesource.com/93115
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-09 17:03:34 +00:00
Andrew Bonventre
25101aadb9 godoc,cmd/getgo: update download links to dl.google.com
Change-Id: Idd003c76edbf9d3ecf3354036e734386c55ed1f2
Reviewed-on: https://go-review.googlesource.com/89695
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-25 02:56:30 +00:00
Agniva De Sarker
f86b507a7e godoc: init corpus in a separate goroutine in http mode
Currently, in http mode the server blocks until the corpus
has been initialized. This can cause considerable delay
if the user workspace is significantly large and the files
are not present in the buffer cache.

This CL spawns off the initialization in a separate goroutine
if httpMode is set and turns on a flag when it's done.
The http handler checks the flag and returns an error response
if it has not been set.

The check is only performed for the path prefixes handled by the
handlerServer struct. Other paths do not call the GetPageInfo() function
and hence can return immediately. This preserves maximum responsiveness
of the server.

Also adds an additional print statement in verbose mode

Fixes golang/go#13278

Change-Id: I0505acc1c190423d09fb199b11ca86e0400e84d4
Reviewed-on: https://go-review.googlesource.com/88695
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-23 16:04:43 +00:00
Andrew Bonventre
b790d0ba03 godoc: set proper content-type header on share request
When sending the request to /share, it defaulted to
application/x-www-form-urlencoded. This caused the body to be
empty since it was sending a form with the actual code as a
key in the r.Form map.

Set the content type explicitly to text/plain.

Fixes golang/go#21691

Change-Id: I0d5981d9c9aa901010af65b0d0a7670870b77f2b
Reviewed-on: https://go-review.googlesource.com/86317
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-05 03:31:22 +00:00
Andrew Bonventre
08da88d271 godoc/proxy: remove unused cacheKey function
Change-Id: Ic7392e973de4a8c9232e9c55ed76c4ca799d68b4
Reviewed-on: https://go-review.googlesource.com/86315
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-05 02:11:35 +00:00
Andrew Bonventre
951512dfed godoc: proxy /compile requests to play.golang.org
Now that play.golang.org and sandbox[-flex].golang.org have been
merged, proxy requests to the former.

Change-Id: I7d18d0494fd54c2357dc53952fa458ceb1380aca
Reviewed-on: https://go-review.googlesource.com/86253
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-04 23:58:58 +00:00
Andrew Bonventre
64890f4e2b godoc: fix missing search icon on /dl and correct borders
Some default browser stylesheets set a border radius on <button>
elements that was not being overridden in style.css. The button
should not have any border radii on the left as it should look
like an extension of the search field.

Change-Id: I458bd2e3a903a4c1dd246ff0304e7d3cf29c0988
Reviewed-on: https://go-review.googlesource.com/83296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-12-11 20:09:31 +00:00