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

2344 Commits

Author SHA1 Message Date
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
77106db15f cmd/godoc: fix TestWebIndex test
The godoc in the test was indexing sources in the default GOPATH.
If the default GOPATH pointed to local workspace, test would timeout.
The fix is to supply GOPATH set to non-existing path.

Fixes golang/go#24504

Change-Id: Iedf044cdec78d5c5642105650ad8ec17aa10a5ba
Reviewed-on: https://go-review.googlesource.com/102295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-24 18:54:18 +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
Colin
2226533658 refactor/eg: Add support for multi line after statements to eg.
The semantics of this change are that the last line will be subsituted
in place of the expression, where as the lines before that will undergo
variable substitution and be prepended before the lowest (in the AST
tree sense) statement which included the expression.

Change-Id: Ie2571934dcc1b0a30b5cec157e690924a4ac2c5a
Reviewed-on: https://go-review.googlesource.com/77730
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-03-19 17:51:41 +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
Robert Griesemer
c4b4e4b0fa cmd/guru: fix .golden file (fix build)
This regression is due to https://go-review.googlesource.com/c/go/+/100235
which made the go/scanner behavior match the compiler's scanner by
not modifying filenames in line directives in any form. Specifically,
relative filenames now remain relative. This makes it easier to reason
about the behavior of the scanner but may require clients to adjust
those filenames.

If removing the longer path in the .golden file is not satisfactory,
the (scanner) client may have to massage positions returned via line
directives; or better, the line directives are created with extended
path information.

R=adonovan

Change-Id: I836571a6dafef5e6d81e4c7add203c994e107055
Reviewed-on: https://go-review.googlesource.com/101015
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-16 01:01:07 +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
Nick Miyake
c41d143952 imports: support match without trailing slash for -local flag
Make it so that import prefixes specified using the -local flag are considered
a match for an import path if the prefix ends with a '/' and the import path
matches exactly the prefix without a slash. For example, specifying
"golang.org/x/tools/" as a prefix would match the import for the package
"golang.org/x/tools".

Fixes golang/go#24368

Change-Id: I0302db72fda63ad24d7b964aa73f78aa0ebccb37
Reviewed-on: https://go-review.googlesource.com/100460
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-15 06:52:34 +00:00
Andrew Bonventre
d853e8088c CONTRIBUTING.md: remove note about not accepting Pull Requests
Updates golang/go#24185

Change-Id: I6462c066b7efc4086496d9ed5e85a0d826f962bd
Reviewed-on: https://go-review.googlesource.com/100716
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-03-14 18:02:17 +00:00
Ian Cottrell
c1547a3f90 imports: Limit the amount of text printed in the large token case
If the test fails, it tries to print a million characters.
This limits it to just the start of got and want, which is enough to see
the imports block anyway.

Change-Id: I2c58db8e96e73da436ca16fa8a57c820a95242ca
Reviewed-on: https://go-review.googlesource.com/100216
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-03-13 18:49:02 +00:00
Nishanth Shanmugham
059bec968c cmd/goimports: support multiple comma-separated imports in -local flag
In cmd/goimports, allow for the -local flag to accept a comma-separated
list of import path prefixes. Also, update the imports package
accordingly to support this.

Fixes golang/go#19188

Change-Id: I083d584df8c3a77532f0f66e9c5d970960180e0d
Reviewed-on: https://go-review.googlesource.com/85397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-03-05 19:26:41 +00:00
Dmitri Shuralyov
9f6d4ad827 go/buildutil: use build.Import to find GOPATH containing x/tools
Previously, the test assumed that golang.org/x/tools was always in the
first GOPATH workspace. It may not be. Find it dynamically instead.

Fixes golang/go#19400.

Change-Id: I9c75d5ff1409aebd403d7ad4314b496fe1a04140
Reviewed-on: https://go-review.googlesource.com/94900
Run-TryBot: Dmitri Shuralyov <dmitri@shuralyov.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-03-05 17:28:52 +00:00
Yury Smolsky
73e16cff9e imports: show detailed error when directory cannot be opened
Fixes golang/go#24154

Change-Id: I2834cc2578e911499cbce5412fe6a9041248794d
Reviewed-on: https://go-review.googlesource.com/97359
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-27 18:22:17 +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
Andrew Bonventre
733d489786 cmd/godoc: add x/lint and x/vgo redirects
Change-Id: I6e21f167091338600c2a0a37411b0a565d27ce36
Reviewed-on: https://go-review.googlesource.com/96196
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-22 03:57:22 +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
Dmitri Shuralyov
e8fdd2090a go/vcs: fix command injection in VCS path
Apply same change as CL 94656 did for cmd/go/internal/get, but for
golang.org/x/tools/go/vcs, to help keep them in sync.

It indirectly includes changes from CL 94603, since CL 94656 was
rebased on top of CL 94603.

Updates golang/go#23867.
Helps golang/go#11490.

Change-Id: I33eca1aba19f47bbe3e83d4ef9f9cc9a9c9ae975
Reviewed-on: https://go-review.googlesource.com/94899
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-21 04:00:24 +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
Alan Donovan
2c62430689 go/callgraph/cha: fix bug computing correspondence of abstract/concrete methods
In a dynamic interface method call x.f() where x has type I, it is not sound
to assume that the receiver of the types.Signature for types.Func f has type I, as
Func objects for abstract methods may be shared by multiple interfaces.

Fixes golang/go#23925

Change-Id: I755e3010d1310480c46855e072946346626b3e59
Reviewed-on: https://go-review.googlesource.com/95697
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-21 01:23:17 +00:00
Andrew Bonventre
5e776fee60 cmd/tip: update talks hash to pull in e00c182
Updates golang/go#21643

Change-Id: Ic662ac6ca152d8cf702b02651f55936a29a2e234
Reviewed-on: https://go-review.googlesource.com/95675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-20 22:33:34 +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
Dmitri Shuralyov
a4ae709237 go/vcs: add package comment
According to https://golang.org/doc/effective_go.html#commentary,
"Every package should have a package comment."

Updates golang/go#11490.

GitHub-Last-Rev: 8dd80d0f1cbd94ab14dbfdbf0199ca199f33e1fd
GitHub-Pull-Request: golang/tools#22
Change-Id: Ia3af83cc68bcde12c37492ad240031aecf6934a3
Reviewed-on: https://go-review.googlesource.com/93081
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-14 20:11:16 +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
Antonio Antelo
6c27c68f27 imports: fix mangled comments after package clause insertion
Fixes golang/go#12097

Change-Id: Ie6a6aa997e89700e49d703b7fd00f515b03ad6f8
Reviewed-on: https://go-review.googlesource.com/93235
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-14 03:58:58 +00:00
Daniel Martí
90b807ada4 all: fix a few issues found by unparam
In cmd/present, a mode was being passed to the function parse, but it
wasn't actually being used. Use it.

In go/ssa, checkFinalInstr received an idx integer but it doesn't
actually need it. Get rid of it.

Lastly, in imports, findImportStdlib always returned rename==false. Get
rid of that result parameter.

Change-Id: I719006b69ee80a3ef4b0ea24c1c206016a7e304b
Reviewed-on: https://go-review.googlesource.com/93596
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-13 22:52:51 +00:00
Nikhil Benesch
c0251d31d2 imports: handle arbitrarily long lines
Previous work to resolve golang/go#18201 increased the maximum line
length that goimports could handle to 1MiB (CL83800), but generated code
can result in Go files with longer lines. Use a bufio.Reader instead of
a bufio.Scanner to support arbitrarily long lines, as permitted by the
Go spec.

Change-Id: If719e531859804304d60a8c00db6304ab3d5fe5e
Reviewed-on: https://go-review.googlesource.com/93439
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-13 22:26:52 +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
Ian Lance Taylor
f05340fad4 .gitignore: roll back ".gitignore: ignore emacs backup files"
The .gitignore file should only list files created by the build.

Change-Id: I0cab4662e54a560851cf5d9c4b4d18c4eb9a6bb6
Reviewed-on: https://go-review.googlesource.com/93437
Reviewed-by: Rob Pike <r@golang.org>
2018-02-13 00:43:28 +00:00
Ian Lance Taylor
235755e194 .gitignore: ignore emacs backup files
Change-Id: I283243e963abcdd7e41c58fc6ece79e384bed6e9
Reviewed-on: https://go-review.googlesource.com/93415
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-12 18:22:25 +00:00
Josh Bleecher Snyder
95b47aa5df imports: update zstdlib to Go 1.10
Change-Id: I36e7a5638de2cdcd3523bb3c6c89399586aab938
Reviewed-on: https://go-review.googlesource.com/93195
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-10 03:09:51 +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
Brad Fitzpatrick
66487607e2 cmd/tip: enable HTTP ACME challenges
Updates golang/go#23627

Change-Id: I9dff655b531dc3491419ee1883c570c0bc5d8955
Reviewed-on: https://go-review.googlesource.com/91518
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-02-02 16:21:31 +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
99037e3760 cmd/godoc: allow golang.google.cn as a valid host
Change-Id: I8a585ad64f389f57800afe99824ae249c9f80340
Reviewed-on: https://go-review.googlesource.com/88677
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-01-20 03:13:38 +00:00
Michael Fraenkel
af2bfe26b6 cmd/gomvpkg: Only process paths that are children
When determining children of a parent directory, look for the expected /
to avoid processing directories that look similar but are not direct
descendants.

Fixes golang/go#21991

Change-Id: I5c7d18076540e5588a856845f04645231856196f
Reviewed-on: https://go-review.googlesource.com/65672
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-01-17 19:58:32 +00:00
Alan Donovan
a5d79d28aa go/...: fix/disable broken tests
gp/ssa: add {Start,Stop}TestLog methods to synthesized test main package.

go/ssa/interp: add (not thread-safe) intrinsics for atomic.Value,
which are now used by Getenv.

go/pointer: disable test of callbacks from runtime timers
as the analysis's intrinsics are out of date.  Also fix 3 typos.

Change-Id: I25f95ba18986727275a730b465e7fd23c08b2af2
Reviewed-on: https://go-review.googlesource.com/88055
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-17 18:00:52 +00:00
Agniva De Sarker
8ea45f9674 blog: show a helpful error for invalid template directory
Currently, if the blog binary is executed outside the root directory
without any additional flags, it bails out with the following error -
"open template/root.tmpl: no such file or directory"

This CL prints out a more user friendly error which allows the user to
learn that there is a flag with which the template directory can be set.

Fixes golang/go#22622

Change-Id: I726e7c28f5e5036146769ca01516368f45a6262c
Reviewed-on: https://go-review.googlesource.com/86855
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-01-15 07:04:26 +00:00
Robert Griesemer
fbec762f83 go/internal/gccgoimporter: parse optional escape info in export data
This is a copy of https://go-review.googlesource.com/c/go/+/86977
and brings those changes into the x/tools repo.

It also includes a minor change to parser.go that was done via
https://go-review.googlesource.com/37839 but that wasn't brought
over.

For golang/go#23324.

Change-Id: I84b7cf134fec250ac340e404802158860cb3c630
Reviewed-on: https://go-review.googlesource.com/87295
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-01-11 04:04:09 +00:00
Michael Fraenkel
8cab8a1319 imports: sibling imports must have matching references
When selecting a sibling's import, the unresolved reference must have
been also used otherwise use the normal search to determine the best
possible package to import.

Fixes golang/go#23001

Change-Id: I38a983569991464970ad5921fe7f280dd3e35a2c
Reviewed-on: https://go-review.googlesource.com/82875
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-05 20:15:57 +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
Steve Gilbert
96b5a5404f imports: support files with longer lines
This change set fixes the issue by specifying a max buffer size of ~1 megabyte for Scanner.
Previously the max was not set resulting in the default max which is ~64k.  This increased max should not increase
memory use for smaller, normal files because it is a max and the code expands the buffer as needed for large tokens.

The change set includes an additional change to return an error from the Scanner which was ignored previously.

Fixes golang/go#18201

Change-Id: I11be39af74d5eb3b353ad81ba1cb5404207aa65d
Reviewed-on: https://go-review.googlesource.com/83800
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-03 17:47:52 +00:00