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

2357 Commits

Author SHA1 Message Date
Agniva De Sarker
8723cc7387 blog: revert strings.Builder to bytes.Buffer
The blog repo can still be imported by older Go versions. Hence,
we need to maintain backward compatibility.

Change-Id: I0235d888734c2f191d04924815f8ffea0239aace
Reviewed-on: https://go-review.googlesource.com/107175
Run-TryBot: Kevin Burke <kev@inburke.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-14 19:22:41 +00:00
Agniva De Sarker
d11f6ec946 blog: serve relative links when run locally
Currently, links inside blog articles are absolute links to golang.org.
But when a godoc server is run locally, the blog package should
serve local links pointing to the local godoc server. It is not possible
to simply change the links inside the blog templates to relative urls
because the blog articles are independant pages on their own.
And moreover, they are served from blog.golang.org.

Rather, the blog package consumes and serves blog articles.
So, a flag was added in the Config struct to denote whether
to convert the links or not. This flag is then set from the
call site in godoc package where the blog server is initialized from.

This was required because "golang.org/x/tools/blog" is a package
which can be used by other code to serve blog pages and not just godoc.
This preserves existing functionality for all working code which
imports "golang.org/x/tools/blog" and changes the functionality only
when a godoc server is run locally.

And while here, replace relevant bytes.Buffer occurences
with strings.Builder.

Fixes golang/go#22681

Change-Id: I7dbf9c5f2f93fd0b7e17915238de1c084fcd1431
Reviewed-on: https://go-review.googlesource.com/105835
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-04-13 18:10:15 +00:00
David Url
5e86cd2985 cmd/present: display slide numbers
Fixes golang/go#5331

Change-Id: Iddd45452959823b2e8e3f9b4236a9a9a3968d35f
Reviewed-on: https://go-review.googlesource.com/97058
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-13 16:54:21 +00:00
haya14busa
1c0c7a8cce imports: Process should accept nil src
The comment of Process() implies src can be nil, but it didn't handle
nil src correctly before because parse() doesn't expect nil src.
Passing []byte(nil) to parser.ParseFile() results in error and parse()
tries to parse again by modifying src if src is statement list.

This problem isn't related with cmd/goimports because goimports doesn't
pass []byte(nil) to Process() as src.

Fixes golang/go#19676

Change-Id: Idbaa6646c3907690763eabc798860c56bb9963d4
Reviewed-on: https://go-review.googlesource.com/38613
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-12 23:47:31 +00:00
Brad Fitzpatrick
dc06d3e643 cmd/godoc: support http-01 ACME challenge in optional autocert support
Using same structure & naming as CL 91518.

Fixes golang/go#23627

Change-Id: Ifb73c77d2c39f9f669d425650f9c5bc31bace196
Reviewed-on: https://go-review.googlesource.com/106455
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-11 21:25:11 +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
Tobias Klauser
ccd319aab1 go/ssa/interp: add internal/syscall/unix.syscall_fcntl to fix tests
CL 100077 added the syscall_fcntl function in the internal/syscall/unix
package to refer to syscall.fcntl outside of the syscall package in a
unified way.

Add a replacement that simulates a successful fcntl call to fix the
interp tests.

Change-Id: I05847d222f18a19cb30f1395497e708a027a002e
Reviewed-on: https://go-review.googlesource.com/106415
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-11 19:48:31 +00:00
Brad Fitzpatrick
368a7e18b5 cmd/guru: skip broken test for old Go versions for now
Updates golang/go#24421

Change-Id: Iedcb629135802f78e8f149b377f34e49c8019fe9
Reviewed-on: https://go-review.googlesource.com/106435
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-11 19:25:09 +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
Matthew Dempsky
5dfd8930f2 go/internal/gcimporter: rename from go/gcimporter15
Follow through on promise to remove the old API.

Change-Id: If1f5addfeb1b82acc5a1730474e2f06102dbb615
Reviewed-on: https://go-review.googlesource.com/105977
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-04-10 13:03:03 +00:00
Matthew Dempsky
14d5b80f95 go/gcimporter15: support bimport format v6
Format change introduced by golang.org/cl/105038.

Change-Id: I76eefe9ce7f52743cb5cdcfe77e5ee0b5eb8743f
Reviewed-on: https://go-review.googlesource.com/105976
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-09 23:44:46 +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
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