1
0
mirror of https://github.com/golang/go synced 2024-09-30 14:38:33 -06:00
Commit Graph

384 Commits

Author SHA1 Message Date
Russ Cox
97606e3207 godoc: fix panic in Presentation.ServeFile
The redirect to drop index.html must be done using r.URL.Path,
not relpath, because those might differ. Cutting len("index.html")
bytes off a string that doesn't end in index.html is incorrect.

While we're here, silence an annoying log print during go test.

For golang/go#40665.

Change-Id: I36553b041f53eab9c42da6b77184e90800a97e92
Reviewed-on: https://go-review.googlesource.com/c/tools/+/251080
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-08-27 16:23:30 +00:00
Rebecca Stambler
6be401e3f7 godoc/static: replace innerHTML with textContent
Setting innerHTML is a more heavyweight operation that supports HTML.
What's being done here doesn't use HTML, so it's viable to use the more
lightweight textContent.

Change-Id: I46e9359ffe776001836cc09fea88b04364870db7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/235577
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-05-28 18:54:14 +00:00
Agniva De Sarker
693125cf94 all: run prettier on js and css
Command used: docker run --rm -it --volume "$PWD":/wd agniva/prettier "**/*.{js,css}"

Updates golang/go#21719

Change-Id: I892718781206430a8f85da38a762b54191ce023a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183878
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2020-05-28 15:31:44 +00:00
Dmitri Shuralyov
ead0a56930 godoc/vfs/mapfs: panic on invalid New usage
mapfs.New documentation says:

> Map keys should be forward slash-separated pathnames
> and not contain a leading slash.

It is invalid input if a provided path contains a leading slash, and it
causes the returned filesystem to have undefined behavior. Package mapfs
is often used in tests, so this can lead to a serious problem elsewhere.

Help detect invalid API usage sooner by validating input, and panicking
when it contains leading slashes. Programs that use mapfs API correctly
will be unaffected, and it will be faster for incorrect programs—if any
exist today or will be created in the future—to detect and correct such
problems.

Fixes golang/go#34591.

Change-Id: I77e5f0f4628edf83480604135f58bfb62e521d80
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197859
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-05-08 23:23:36 +00:00
Tamir Duberstein
5e2df02acb godoc/static: update jquery.treeview to 1.4.2
This has the primary benefit of clarifying the license as MIT.

Images have been "losslessly compressed" upstream; see
https://github.com/jzaefferer/jquery-treeview/commit/ca711d9.

Retrieved from
https://github.com/jzaefferer/jquery-treeview/releases/tag/1.4.2.

Change-Id: Ia111cbdf246d9adafa3d1c8cfbd7f0c5763cc935
Reviewed-on: https://go-review.googlesource.com/c/tools/+/223077
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-03-12 15:35:18 +00:00
Rebecca Stambler
207d3de1fa all: fix some staticcheck errors
Updates golang/go#35718

Change-Id: I10bfd5421cd44bb58b8bcaa6e9205040c25f51be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208257
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-01-29 04:53:41 +00:00
Dmitri Shuralyov
6ed6e6036b godoc/static: update copyright year to 2013
The generated static.go file was missing a license header when it was
created in 2013 in CL 12805046. CL 38165 added a license header, using
the current year in the template. This causes the static.go file to go
"out of date" whenever the year changes.

Change the copyright year to be a fixed year when the file was created.
This way, the TestStaticIsUpToDate test will stop breaking every year.

Updates golang/go#36360
Updates golang/go#11811

Change-Id: If1597b0d93b7eacf23b7de103a6d7e3ca049bb4f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/213119
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-02 16:51:58 +00:00
Dan Kortschak
6c68fec0bc all: remove many cases of space-space
Change-Id: I49eb8410d4143c67dfccf027f8b2794e66963415
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212580
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-30 19:07:42 +00:00
Dmitri Shuralyov
b0650ceb63 godoc/static: re-add "or" function call to package.html template
It was removed unintentionally in CL 101295, where the intention was
to remove the (eq $.Dirname "/src") condition.

Updates golang/go#35812

Change-Id: I1591ed221f0d510fb1ffa51a3ecd48d8327fdfbb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208661
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
2019-11-26 05:54:41 +00:00
Dmitri Shuralyov
688c506a55 cmd/godoc, godoc/static: remove remnants of golang.org website
The canonical home for the golang.org website by now is
the golang.org/x/website/cmd/golangorg command. That is
the command that should be used to run the website locally
instead of godoc.

This change reduces the scope of x/tools/cmd/godoc to be
a minimal Go Documentation Server. It removes the remaining
pieces of the golang.org website and changes the title from
"The Go Programming Language" to "Go Documentation Server".

The web tree is modified as follows:

• The index page has been modified to redirect to /pkg/,
  which serves a list of packages.
• The /doc/ tree is removed.
• The /robots.txt and /opensearch.xml pages are removed, since
  the primary use case for godoc now is a local web server.
• The Google Analytics sections are removed from static templates,
  since it's always an empty value in local web server mode.

Fixes golang/go#32011
Updates golang/go#29206

Change-Id: Id62c5f335fa2059774893ef4dcd268649278e99d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/207777
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-11-20 19:55:55 +00:00
Anthony Fok
dc59f20efa all: fix typo ("identifer" → "identifier")
Change-Id: Ib61b94136923ec74154ff56c5237bea1877c8f14
Reviewed-on: https://go-review.googlesource.com/c/tools/+/207843
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-19 21:19:57 +00:00
Dan Kortschak
af92b0ef1f godoc/vfs/zipfs: fix godoc formatting
Change-Id: I0303e362e82b713823b46247d15baa2ff6f6a344
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-07 15:17:16 +00:00
Jay Conrod
7c411dea38 godoc/vfs: fix union logic in NameSpace.ReadDir
ReadDir now returns files from directories in all matching mount
points if no Go files are present in any of them. The behavior now
matches the documentation.

Fixes golang/go#34571

Change-Id: I3a0c8d49a5906ec33ebe9e3efea9d2b9d267506c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197801
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-09-30 20:11:59 +00:00
Dmitri Shuralyov
e7abfedfab godoc, godoc/vfs: improve documentation of GetPageInfo, hasPathPrefix
Change GetPageInfo method documentation to match the method name.

Prefer using "reports whether" in a function that returns a boolean.
This style is more idiomatic.

Updates golang/go#33655

Change-Id: I1a781e7b4f5b4b629fdf4f48e2e97183f63508f9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196977
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
2019-09-29 04:10:59 +00:00
Dmitri Shuralyov
3ac2a5bbd9 godoc: remove Corpus.testDir field
It was indeed unused.

Updates golang/go#33655

Change-Id: Icb9b9a3d201cc573ae294063b64e38890f37b9ab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196978
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 05:20:46 +00:00
Ainar Garipov
feee8acb39 all: fix more typos
Change-Id: I978ad5e1800ebfceb78aaced438331a8341715d4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194697
Reviewed-by: Toshihiro Shiino <shiino.toshihiro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-11 15:13:14 +00:00
Kevin Burke
d72b05d2b1 godoc: apply gofmt
Using Go 1.12.9.

Change-Id: I3df42ca98e9af19742ce4d528eea453ef541f892
Reviewed-on: https://go-review.googlesource.com/c/tools/+/162997
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-08-25 03:11:27 +00:00
Dmitri Shuralyov
09281b52a1 godoc: re-add test for ignoring //line comments in source code
The original CL 84050044 added a test case, and it happened to be
in between various CLI test cases. CLI support was removed from
x/tools/cmd/godoc in CL 141397, as part of golang/go#25443.
Re-add a test case for this behavior to prevent regressions.

Updates golang/go#32092
Updates golang/go#25443
Updates golang/go#5247

Change-Id: I0cea74cfe40d120e398a9005676134c5bad6136c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/177737
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-05-28 20:18:05 +00:00
Dmitri Shuralyov
1da8801a95 godoc: declare small victory over the punched card tyranny
At least inside this one package.

It's because golang.org/x/tools/cmd/godoc no longer has CLI support
as of golang/go#25443, it is now only a web server. Luckily, browsers
that display HTML pages are not constrained to the fixed width of
punched cards. On the contrary, they seem to embrace a wide variety of
arbitrary page widths, ranging from narrow to wide. This is in part due
to the proliferation of internet access on device form factors such as
the mobile phone, tablet, laptop, and desktop.

So the punchCardWidth constant is now unused and can be removed. This
is a followup to CL 141397 that removed most of the CLI support code,
including the function comment_textFunc, which was its only user. Same
goes for containsOnlySpace.

Updates golang/go#25443

Change-Id: I61fabe6ea801c88758fb2c6aefa70b53d52e2cb5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/172975
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-17 16:27:34 +00:00
Andrew Bonventre
d1a3278ee7 godoc/util: serve SVG files raw
When a godoc Presentation is serving a file, it will sniff its
contents to determine if it contains "human-readable" text. If
it does, then it serves the contents of the file with surrounding
HTML. SVG files should not be served with any additional HTML even
though their contents are not a binary format (just like CSS or JS
files).

Updates golang/go#9936

Change-Id: Id3dd3b6cda4f103b08f6e924923426a86bd46ec8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/177498
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-16 01:51:32 +00:00
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