1
0
mirror of https://github.com/golang/go synced 2024-10-01 09:48:32 -06:00
Commit Graph

3773 Commits

Author SHA1 Message Date
Rebecca Stambler
a1005cf9b2 internal/lsp: fix race in checkPackageHandles
We were caching the package before setting the handle, so a
checkPackageHandle might be in use before it was fully created.

Change-Id: Ic98e7c351cbed5e4caa87098e95ad04d4f54f8df
Reviewed-on: https://go-review.googlesource.com/c/tools/+/202040
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-18 19:24:35 +00:00
Rebecca Stambler
0bbdbb2ef6 internal/lsp: associate package with its snapshot
A package really should always be associated with its snapshot rather
than its view. This eliminates some extra parameters in a few utility
functions.

Change-Id: I60f9b7286e0072d3268602f6bd32052a3d2e5559
Reviewed-on: https://go-review.googlesource.com/c/tools/+/202039
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-18 19:08:19 +00:00
Ariel Mashraki
1f7a813c0d tools/internal/imports: fix data race in packageInfo
Before this commit, when running imports.Process concurrently, the program
panics with a fatal error due to concurrent map iterations and map writes.

This CL fixes this by adding a copy of the map to the packageInfo structure.

Fixed #34895

Change-Id: If009e6108813f86495c7e20e69739186b8b236d7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200865
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2019-10-18 18:31:53 +00:00
Michael Matloob
341939e086 go/packages: fix ad-hoc package tests
Make sure that the user's environment doesn't affect the adhoc package
tests. Noticed that one test failed with GO111MODULE=on, so added a hack
to try and support that case. Not sure if that's the right approach.

Fixes golang/go#33374

Change-Id: I373cd57b9982cd46193c61d08e262fd50b5b7e18
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195319
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-18 00:00:36 +00:00
Muir Manders
920acffc3e internal/lsp: fix bad *ast.ArrayTypes for completion
Currently array and slice literals don't work very well for
completion. When go/parser is not expecting a type, it often turns
array types (e.g. "[]int") into *ast.BadExpr, which messes up
completion because we can't figure out the prefix from *ast.BadExpr,
and *ast.BadExprs don't get type checked.

This change addresses the first problem of not being able to figure
out the prefix. If we see an *ast.BadExpr, we now blindly try to
reparse it as a composite literal by adding on "{}". If we end up with
an *ast.CompositeLit with an *ast.ArrayType "Type", we swap
the *ast.BadExpr for the *ast.ArrayType. This approach is dumb but
simple, and fixes lexical completions in array types.

Change-Id: Ifa42e646bcbf2a30170d73e6dd11982384d40b43
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197437
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-17 20:53:01 +00:00
Rebecca Stambler
de666e9706 internal/lsp: add a test to make sure we handle bad imports
There was a regression where gopls would not type-check any package with
a bad import. This change fixes the regression and adds a test to make
sure it doesn't happen again.

Change-Id: I3acf0917d46e9444c20135559f057f0ecd20e15b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201539
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-17 20:52:05 +00:00
Nathan Dias
e4d7c6f25b internal/telemetry/export/ocagent: convert Histogram metrics
This change adds support for converting HistogramFloat64Data and
HistogramInt64Data to *wire.Metric. Timestamps are not attached
as they are not yet available.

What works:
* convertMetric will now convert HistogramInt64Data and
HistogramFloat64Data to *wire.Metric.

What does not work yet:
* StartTime and EndTime will not be attached to timeseries and
points.
* MetricDescriptors will not have a unit attached.
* No labels will be attached to timeseries.
* Distributions will not have SumOfSquaredDeviation attached.

Updates golang/go#33819

Change-Id: Iee52ab751542ee1ade07ef32120de853b41fd27b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200538
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-17 16:38:57 +00:00
Rebecca Stambler
a3bc800455 go/expect: support markers in comments in go/packagestest
This is specifically necessary to test CL 197879.

Change-Id: I2b4bbdd322d52097fc1444242d3e26a3d8ea75e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201520
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-17 15:15:54 +00:00
Ainar Garipov
846f856e7d gopls/doc: fix issue links for vim-lsc
Change-Id: Iecdc087da7e48a170616e0453c5c4fe1a45ef95e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201419
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-17 10:18:17 +00:00
Muir Manders
0abb09c987 internal/lsp: search for deep completions across function calls
We now continue deep completion search across function calls. The
function must take no arguments and return a single argument. For
example, when completing "fo<>" you might get candidates such as
"foo.bar().baz()".

Previously we would stop searching for deep completions when we hit a
function call. For example, we would stop at "foo.bar()", never
finding "foo.bar().baz()". At the time I was worried about the search
scope growing too large, but now that we dynamically limit the search
scope there isn't much left to worry about.

Change-Id: I48772c154400662876682503c1f58ef6e3dca688
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201222
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
2019-10-17 03:50:25 +00:00
Muir Manders
02335f11d5 internal/lsp: don't qualify literal candidates in *ast.SelectorExpr
Previously we unconditionally qualified literal candidate types with
their package. For example:

var buf *bytes.Buffer
buf = &bytes.Bu<>

would complete to:

buf = &bytes.bytes.Buffer{}

Now we don't qualify the type if the cursor position is in the
selector of an *ast.SelectorExpr. We only generate literal candidates
for type names, so if we are in a selector then we can assume it is a
package qualified type (as opposed to an object field).

We also handle the insertion of "&" for literal pointers better. If you are in
the selector of an *ast.SelectorExpr, we prepend the "&" to the beginning of the
expression rather than the selector. For example, you will end up with
"&bytes.Buffer{}" instead of "bytes.&Buffer{}".

Updates golang/go#34872.

Change-Id: I812aa809cd4e649a429853386789f80033412814
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201200
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-16 23:29:27 +00:00
Muir Manders
5bac78f585 internal/lsp: add label completion candidates
Now we offer completion candidates for labels when completing "break",
"continue", and "goto" statements. We are reasonably smart about
filtering unusable labels, except we don't filter "goto" candidates
that jump across variable definitions.

Fixes golang/go#33987.

Change-Id: If296a7579845aba5d86c7050ab195c35d4b147ed
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197417
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-16 23:06:01 +00:00
Rebecca Stambler
f6a1a6ff8e internal/lsp: check if the go/packages context has been canceled
Recently been noticing errors where we don't have full metadata for a
given package. It seems to me that, since we added the context to the
packages.Config, there have been cases where the context is canceled on
the first load, and then we type-check with incomplete data. I'm still
not sure if allowing go/packages to be canceled is the correct approach.

Change-Id: I6767ce763538bd579458c8f8db07f15c9eec7b4a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201518
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Muir Manders <muir@mnd.rs>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 22:21:47 +00:00
Rebecca Stambler
eec4c98bf5 go/packages: fix staticcheck warnings
Ran gopls with staticcheck enabled and found these warnings.

Change-Id: I0b41c0daa19ac98c778d643530c9cb3f5f994399
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201442
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 22:20:41 +00:00
Rebecca Stambler
6f5e27347a go/packages: handle invalid files in overlays
This change handles a specific case where `go list` returns an error on
a file that lacks a package declaration. If only one package is returned
as a response, we should add that file to that package, since it may
have valid content in an overlay.

This change uses the internal/span package to correctly parse the error
message from `go list`.

Change-Id: I5909c4fd765746df1003685aa915b7c5f9cdcee5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201220
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 22:16:03 +00:00
Rebecca Stambler
f0068bd333 internal/lsp: remove misleading check span
This span resulted in misleading information, since it would appear any
time you called the Check function. This function often returns cached
results, so it's not particularly useful.

Change-Id: I26be652a99b906fb2e8703ff9af86fbe2ef5fc5d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201219
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-16 19:48:01 +00:00
Michael Matloob
ba31bb9056 go/analysis: remove requirement for unique Analyzer names
It's hard to prevent two independent analysis writers from
using the same name so enforcing this requiremnet just
causes trouble for analysis writers. Remove the requirement.

It would be nice to guarantee that two packages don't introduce
analyses with the same name, but because analyses are values
and not types, they don't have a logical package.

Change-Id: Iad3493e02ceae04ba3e9015c3e9c68ed9fa4b5a2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201218
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
2019-10-16 18:38:41 +00:00
Rebecca Stambler
89dd9f8220 go/packages: handle multiple modules in gopackagestest
Adding a second module to the gopackagestest configuration exposed a
flaky failure. go/packages was attempting to construct an ID relative to
a module. Depending on which module it saw first, it could construct a
relative path based on the incorrect module. Add an additional module to
the overlay tests to make sure we don't regress here.

Also, fix up a few staticcheck errors that were spotted along the way.

Change-Id: I53c2c0eee62ff88eadcb96a3770452dd7799312e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199645
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-16 18:04:19 +00:00
Pontus Leitzler
6223712555 internal/lsp: fix lsp trace log format for gopls
The -rpc.trace flag in gopls enables logging in "lsp inspector format".
Currently sent responses isn't parsed by the lsp inspector so it fails to
parse gopls logs.

The lsp inspector regexp matcher requires the duration to be prefixed with
"took" instead of "in", e.g. "took <d>ms.".

This change updates gopls to match the log parser in lsp inspector,
see 9aff7a6939/lsp-inspector/src/logParser/rawLogParser.ts (L88)

Change-Id: I3696faf34ba4f0b3d4e205693eaf378941f2f68f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199517
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-16 17:14:07 +00:00
Rebecca Stambler
9c6d90b5a7 internal/lsp: use the analyzer's pointer instead of name
Analyzer names are not guaranteed to be unique.

Change-Id: I4d4cc9fa746cbfbea9926f2cae0eb5dfc41027a5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201217
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-15 21:12:01 +00:00
Rebecca Stambler
f936694f27 internal/lsp: add analyses to the snapshot
This change makes sure that actionHandles are cached within the
snapshot, to minimize the cost of re-computing action handles on each
run of go/analysis.

Change-Id: If6191c5224285eb207aebb997787ea551a47fbaa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201098
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-10-15 15:04:14 +00:00
Daved
18e3458ac9 cmd/present: fix origin mismatch for websocket when using HTTPS
Fixes golang/go#31328

Change-Id: Ib190f42970d5b203e3f1fbf997aa896cf624bf91
Reviewed-on: https://go-review.googlesource.com/c/tools/+/171118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 20:52:21 +00:00
Michael Matloob
539cdc44f8 go/packages: temporarily disable some tests running on go tip with -race
A change in go/types has uncovered a race in go/packages. While we debug,
ignore those tests when running on tip with -race to make the builders
green. This change will be reverted as soon as the issue is fixed.

Updates golang/go#31749

Change-Id: I96f0b30a1bc203a5c36a2ce30c943583b7f8035a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200819
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-14 17:20:00 +00:00
Rebecca Stambler
b53505e708 internal/lsp: cache analysis using memoize package
This change moves to the approach of caching the analysis using the
memoize package. This means that we will do less work, as we no longer
need to recompute results that are unchanged. The cache key for an
analysis is simply the key of the CheckPackageHandle, along with the
name of the analyzer.

Change-Id: I0e589ccf088ff1de5670401b7207ffa77a254ceb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200817
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-14 17:19:42 +00:00
Shengjing Zhu
5fa5b1782b gopls/doc: instructions for adding settings in coc.nvim
Change-Id: I7d69477cc103e8e45b0e9394e32945a0d8ee19b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200868
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-14 14:15:50 +00:00
Peter Weinberger
8de300cfc2 internal/lsp/protocol: handle case of an otherwise empty notification
Some notifications, like exit, have no other arguments, a case the code
was not handling correctly.

Change-Id: Ib5ff536352ba6ad0d09cd80c9d5f0a987abbe500
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200298
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Peter Weinberger <pjw@google.com>
2019-10-12 15:20:04 +00:00
Michael Matloob
4c025a95b2 go/packages: make a copy of the config.Env slice in the test.
Before this change, we were "saving" config.Env and then appending
to it to create a new slice, like so:

  savedEnv := config.Env
  ...
  // for each test case
    config.Env = append(savedEnv, additionalValue)

but we're modifying savedEnv during each env. Even though it might
work, it's not doing what we expect. Clean this up.

Change-Id: Idcf8199d836241df2b934308863512c566c0c485
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200769
Run-TryBot: Michael Matloob <matloob@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 21:18:36 +00:00
Emmanuel T Odeke
7667e13ae9 internal/telemetry: modify *Subscriber to take timeAt
Modifies the various Subscriber signatures to take in
an "at" time.Time field, which captures the time that
a measurement was made. This field will then be used
when exporting points as their EndTime.

Fixes #34490.

Change-Id: I9e87b65e374876ae3d4df0abedb64bb7dcb221b6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199577
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-11 20:42:57 +00:00
Muir Manders
59731289e9 internal/lsp: include context in go/packages config
Include the context when invoking go/packages.Load so it is
cancelable. Otherwise if the user is manually typing an import or
otherwise messing around with imports, a big queue of potentially very
slow go/packages.Load calls will build up.

Fixes golang/go#34414.

Change-Id: I80732086b478b908c720739708dd773e81fe2b81
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200058
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 19:56:53 +00:00
Rebecca Stambler
638914d249 internal/lsp: return an error from {Narrowest,Widest}CheckPackageHandle
This will prevent us from panicking in cases with errors.

Fixes golang/go#34824

Change-Id: I02c20655f6926ec00c1591a905ff5a107cc44192
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200300
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-11 16:51:06 +00:00
Ian Cottrell
5889748991 internal/lsp: use options hooks to install diff driver
Change-Id: I2f94c2a68d0036a47ccac3fce07cf9f3b784d443
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200558
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:38:31 +00:00
Ian Cottrell
17d4c77023 internal/lsp: fix unified diffs of edits at the end of a file
Change-Id: I3a7db9261f0bc16609af6d58b363ec52474cb07e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200697
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:38:14 +00:00
Ian Cottrell
2c43fbf27d internal/lsp: fix test failures caused by diff algorithm variance
Fixes golang/go#34833

Change-Id: I7f8c1d3214914af40a8b9c3532f9a0a6e17246c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200557
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-11 16:37:56 +00:00
Ian Cottrell
e5ffc44a6f internal/lsp: remove edit fixups from rename now diff is functional
Change-Id: I9b26388abe4b1470605852c71c397c7fddf7fdef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199740
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:19:05 +00:00
Ian Cottrell
a26de0c301 gopls: use go-diff for edit generation
this supports sub-line diffs and is much faster

Fixes golang/go#33003
Fixes golang/go#32586
Updates golang/go#31937

Change-Id: I02f82c75828e7e3ec804e8beee916893d4c14b3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/191018
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:18:25 +00:00
Ian Cottrell
7025dca8be internal/lsp: expand edits to whole lines in ToUnified
We don't want to support sub line edits or non line context in the unified diff
printing.

Change-Id: I4267b11b50f12d817dac0fbbae7e1db44ca3dad0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199739
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:14:46 +00:00
Ian Cottrell
6ac766747f internal/lsp: merge diffing test data sets
also improve the actual verification of the unified diff

Change-Id: I9c23c24e1fc8571cce2a7879463659ec7069fe99
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199738
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-10 20:13:25 +00:00
Ian Cottrell
7822de7a2d internal/lsp: fix patch tests on builders
Fixes golang/go#34620

Change-Id: Id8e2310c27d5697a8988b9e8dc85be979f9b8d40
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199737
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-10 20:12:59 +00:00
Jay Conrod
8abd424004 internal/imports: skip TestModeGetmodeVendor
Test is broken by recent cmd/go vendoring changes. Skipping the test
case while we figure out what to do.

Updates golang/go#34826

Change-Id: I31a6f18e40420970251e25836edcf32c56c10ef5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200299
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-10 17:12:13 +00:00
Nathan Dias
0337d82405 ocagent: convert Int64Data and Float64Data metrics to *wire.Metric.
Histogram data still needs to be converted and
timestamps are not attached as they are not yet available.

What works:

* convertMetric will now convert Int64Data and Float64Data.

What does not work yet:

* Histogram64Int and Histogram64Float will still not be converted.
* StartTime and EndTime will not be attached to timeseries and points.
* MetricDescriptors will not have a unit attached.
* no labels will be attached to timeseries.

Updates golang/go#33819

Change-Id: I65f9af716ba6282e809d0a9d10777d70475e4c83
GitHub-Last-Rev: 10820a9971e1f4c0529fadc567b2533256c2e961
GitHub-Pull-Request: golang/tools#170
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199857
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-10 07:50:00 +00:00
Brad Fitzpatrick
b090f1f240 go/analysis/passes/asmdecl: remove amd64p32 support
Updates golang/go#30439

Change-Id: I46c7de8d16c3470f2f20a4d0e03b74bb38c8aff0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199500
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-10-09 21:34:38 +00:00
Ian Cottrell
6536af71d9 internal/span: end of file is now last line +1
We already accepted it as a valid input, but for output we still produced
last_line,last_column+1
Also add package docs and improve error messages

Change-Id: I017aa326e8392134e67e8fabec47e750c8055454
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199641
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-07 18:54:44 +00:00
Agniva De Sarker
79dbfd6c86 cmd/godoc: update findGOROOT
After godoc stopped being part of the Go distribution, the location
of the godoc binary and the go binary can be different. Hence the old
GOROOT finding logic does not work anymore.

We shell out to "go env GOROOT" to return the new GOROOT.

Fixes golang/go#23445

Change-Id: I16e4c0798e3f5cda13d9f6546cf82808a10c4a0b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199279
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-07 18:40:23 +00:00
Rebecca Stambler
944452d4f0 internal/lsp: stop cluttering logs with highlight errors
We used to return an error from textDocument/highlight if the cursor
wasn't over an identifier. Logging these errors is not useful, as the
cursor is often not on an identifier.

Change-Id: Ibb43908149315c72923a22bdca567aa2b3ee68d8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199640
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-07 17:20:23 +00:00
Panos Georgiadis
83b12cb08e Fix vscode config to watch file changes
Fix the documentation by using the correct configuration for
watching file changes outside of the editor.

Fixes https://github.com/microsoft/vscode-go/issues/2810

Change-Id: Ib550d9831fe4563ceb5917d9196b201a03b051d2
GitHub-Last-Rev: 86c49abed8a0c79b641e02a23128b4654d2d6d48
GitHub-Pull-Request: golang/tools#169
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199578
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-07 17:02:13 +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
Ian Cottrell
c9f9432ec4 internal/lsp: clean up ApplyEdits
This should be a faster but equivalent implementation.

Change-Id: I7bc756644c601b953ba7715e093bfa10ca5ea97b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198878
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-05 01:44:04 +00:00
Ian Cottrell
5bee6a6eb8 internal/lsp: cleanup the diff package
Make sure everything is documented and move things to sensible files now all the
cross package shuffling is done

Change-Id: I884053a207d6741cda066afa5da91b00f1dfd31c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/198877
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-05 01:43:51 +00:00
Michael Matloob
43d3a2ca2a go/packages: update tests to reflect changes in golang.org/cl/198459
That change changes the name of an ad-hoc package go list produces
to contain the names of the files instead of just being called
"command-line-arguments". It also means go list will report multiple
packages for an ad-hoc package that's not saved on disk that contains
multiple sources.

Update test cases that depend on this behavior.

One thing to be aware of: the change in go list (without additional
changes in go/packages) will break users depending on ad-hoc
packages with multiple files, when the any of the  files don't exist
on disk. We're not adding a work-around in this cl because overlays
aren't guaranteed to be 100% correct and the LSP doesn't need this
functionality. If this turns out to be a problem we can fix it.

Change-Id: I342cd3cb54bf35992186ee02ddd9ac316ff1db4f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199097
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-10-04 21:17:43 +00:00
Matts966
d89860af3b go/analysis/analysistest: fix nil pointer dereference when sorting facts
Without this change, we can't use `ExportPackageFact` function with analysistest package.

PackageFacts are keyed by nil and analysistest.check crashed while sorting, due to a nil object dereference.

Change-Id: Ic94c71acc9c74012bf150e1d72e937da8dfdff75
GitHub-Last-Rev: 51c91008a6756e66c630bfeabc9b8da08c12bfdd
GitHub-Pull-Request: golang/tools#163
Reviewed-on: https://go-review.googlesource.com/c/tools/+/196758
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-10-04 19:10:47 +00:00