1
0
mirror of https://github.com/golang/go synced 2024-10-01 07:28:35 -06:00
Commit Graph

2833 Commits

Author SHA1 Message Date
Alan Donovan
6d96510a3a go/analysis/passes/copylock: split out of vet
Change-Id: Ib7c735e714d8b5436d055bf99ca90e840c963c7b
Reviewed-on: https://go-review.googlesource.com/c/140740
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-09 17:21:31 +00:00
Alan Donovan
a2b3f7f249 go/analysis/passes/assign: split out from vet
Also: create internal/analysisutil package for
trivial helper functions shared by many vet analyzers.
(Eventually we may want to export some of these functions.)

Change-Id: I2b721a16989826756d0426bc7f70089dfb1ef9ce
Reviewed-on: https://go-review.googlesource.com/c/140577
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-08 20:59:24 +00:00
Bryan C. Mills
a2cab1077b cmd/gorename: set GO111MODULE=off in gorename_test
Updates golang/go#27858

Change-Id: Ia823c49d8f05831c833df9f745a879c94c915626
Reviewed-on: https://go-review.googlesource.com/c/139319
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-08 20:39:09 +00:00
Michael Matloob
2f1727f1b3 go/packages: add basic support for overlays
This allows users of go/packages to replace the contents of already
existing files, to support use-cases such as unsaved files in editors.

BREAKING CHANGE: This CL changes the signature of the function provided
to Config.ParseFile.

Change-Id: I6ce50336060832679e9f64f8d201b44651772e0b
Reviewed-on: https://go-review.googlesource.com/c/139798
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-08 20:38:53 +00:00
Alan Donovan
aa04744b49 go/analysis/passes/loopclosure: split out of vet
This analysis was renamed from "rangeloops" since it applies equally
to non-range for-loops.

Change-Id: I441378b29d36aaf7fe102913c5b3aaa7cfd351a0
Reviewed-on: https://go-review.googlesource.com/c/140578
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-08 20:02:22 +00:00
Alan Donovan
ae971d7220 go/analysis/passes/asmdecl: split out of vet
Also: extend analysistest to extract '// want ...' comments
out of non-Go source files such as assembly.

This change also moves asm8.s file into the right directory
so that it gets exercised by the test.

All the .s files were git-mv'd and then the ERROR comments
were changed to 'want'; also +build vet_test tags were removed.
Sadly Gerrit reports the old and new files as unrelated...

Change-Id: I8a2ecd6dd6fb0e20630f0ba6205c4378e4e912b3
Reviewed-on: https://go-review.googlesource.com/c/140120
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-08 17:41:44 +00:00
Alan Donovan
8a9223ac31 go/analysis/passes/buildtag: split out of vet
buildtag checker:
- This checker has been modified from the version in vet to handle Go
  and non-Go files differently, to avoid having to re-read-and-parse
  Go files in the common case.
- The old cmd/vet driver would run this check on all the files in
  a directory whereas new drivers will run it only on the files
  selected for a particular configuration, so some of the checks
  (those in checkArguments) will never fire. But this is not a regression
  relative to 'go vet', because it too presents cmd/vet with only the
  files selected as part of the package.

analysistest:
- fix bug that processed a block of //-comments as one.
- treat "...// want..." within a //-comment as a want comment.
  This is required for adding expectations on lines that are already comments.

Change-Id: Iacf3684864e07532f77176481afbf059a9638f3b
Reviewed-on: https://go-review.googlesource.com/c/139797
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-08 17:33:41 +00:00
Alan Donovan
1ca53e67e5 go/analysis/passes/lostcancel: split out from vet
Change-Id: Id19410d1e81ae29813404cd2e9781f57813110ef
Reviewed-on: https://go-review.googlesource.com/c/139677
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-08 17:32:00 +00:00
Alan Donovan
4601f5daba go/analysis: write package documentation
godoc: http://100.101.181.83:8000/pkg/golang.org/x/tools/go/analysis/
(Apologies to those not on Google corp network.)

Change-Id: I9e21e551443d3048cf247696367d6d06aa7da13e
Reviewed-on: https://go-review.googlesource.com/c/139678
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-08 17:31:26 +00:00
Chris Broadfoot
f60d9635b1 cmd/godoc: add version info for golang.org
Adds version information for package docs for the production version of
godoc running on golang.org.

Updates golang/go#5778.

Change-Id: I8b56e8152b20b34104f274263a6c0b5a0180093b
Reviewed-on: https://go-review.googlesource.com/c/139557
Reviewed-by: Devon H. O'Dell <devon.odell@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-06 00:25:42 +00:00
Alan Donovan
3a5b620dc5 go/analysis/passes/ctrlflow: an Analyzer that builds CFGs
The ctrlflow Analyzer builds a control-flow graph (see
golang.org/x/tools/go/cfg) for each named and unnamed function in the
package.

It computes for each function whether it can never return, either
because the function is an intrinsic that stops the thread (e.g.
os.Exit), or because control never reaches a return statement, or
because the function inevitably calls another function that never
returns.  For each such function it exports a noReturn fact.

This change also:
- adds 'inspect', another Analyzer that builds an optimized AST
  traversal table for use by nearly every other Analyzer.
- changes analysistest.Run to return the analysis result to enable
  further testing.
  (This required changing it to analyze one package at a time,
  which is no less efficient, and is the typical case.)

Change-Id: I877e2b2363a365a9976aa9c2719ad3fba4df2634
Reviewed-on: https://go-review.googlesource.com/c/139478
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-05 21:26:26 +00:00
Michael Matloob
e60d0f5bfd go/packages: skip TestLoadImportsC when Go has been built without cgo
This test is unsurprisingly failing on the nocgo builder because
the cgo packages don't exist on those builders.

Updates golang/go#28040

Change-Id: I633b73bb48e76824645e4e8dd141fb42c9adc19f
Reviewed-on: https://go-review.googlesource.com/c/140121
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-05 20:28:39 +00:00
Alan Donovan
59602fdee8 go/analysis: several little fixes
internal/checker
- don't display "[name.category]" in diagnostic
  output. Most users don't care which analyzer reported the message.
  The -json output retains this information.
- print better log messages for analyze -debug=f.
- print (non-JSON) text output to standard error, like a compiler would.

passes/pkgfact
- fix a nil deref panic when encountering non-renaming imports.
- require names to have underscores before and after (_x_)
  as this avoids a huge number of spurious matches in (e.g.) the
  syscall package.
- don't export empty facts.

Change-Id: I86c003b96521334e371f9d5fcea1323cd779d7f0
Reviewed-on: https://go-review.googlesource.com/c/139657
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-04 16:37:42 +00:00
Alan Donovan
211dcd1cef go/analysis/analysistest: unset GO111MODULE and GOPROXY
CL 139320 unset these env vars for the whole process in two tests,
but the correct fix is to unset them for subprocesses forked by go/packages.

Change-Id: I35e3ab9e424b00326e9e813e4daf0ae92ec36e26
Reviewed-on: https://go-review.googlesource.com/c/139477
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-04 16:37:18 +00:00
Chris Broadfoot
1f2a8f46bd cmd/godoc: add cloud build config
Deploys no longer depend on Docker.

With only Make and gcloud installed, the following should deploy a new version:

$ git clone https://go.googlesource.com/tools
$ cd tools
$ cd cmd/godoc
$ make cloud-build deploy

Updates golang/go#27205.

Change-Id: I5cc1142e02dc288450d55dbd4da4b30c0a080bd5
Reviewed-on: https://go-review.googlesource.com/c/139240
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-04 02:18:13 +00:00
Chris Broadfoot
a3d532c85d cmd/godoc: add make publish to migrate traffic
Also rename `make build` and `make push` to `make docker-build` and
`make docker-push` in preparation to introduce Cloud Build (removing
the dependency on Docker).

Updates golang/go#27205.

Change-Id: Iae19b9a6f77d09246a1332c7ec9eceec449cdba8
Reviewed-on: https://go-review.googlesource.com/c/139239
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-04 01:25:03 +00:00
Bryan C. Mills
140737fa61 go/analysis/analysistest: set GO111MODULE=off in TestTheTest
This fixes 'go test ./...' in the root of the tools repo with GO111MODULE=on.

Updates golang/go#27858

Change-Id: I7492d2a2406997a399fe2badd24882fcb19d37c5
Reviewed-on: https://go-review.googlesource.com/c/139320
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-03 20:16:35 +00:00
Rebecca Stambler
8e930c1793 go/packages: change ParserError to ParseError
Correct minor typo from
https://go-review.googlesource.com/c/tools/+/139317/3.

Change-Id: I76b661fbe136914b903011990e48c74563115ae6
Reviewed-on: https://go-review.googlesource.com/139318
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-03 17:47:30 +00:00
Alan Donovan
71dfda0503 go/analysis/analysistest: support testing of facts
This change adds support for testing the facts produced by an Analyzer
using a similar mechanism to the way it checks for diagnostics.

A "// want ..." comment may now contain a mixture of expectations for
diagnostics and facts. Diagnostics are indicated by a string literal,
as before. Facts are indicated by name:"regexp" where name identifies
the object (declared on the same line) with which the fact is
associated.

  func neverReturns() { // want neverReturns:"noReturn"
       for {}
  }

Also:
- analysistest: report errors during package loading.
  (We don't yet have a way to test RunDespiteErrors Analyzers in the
  face of errors.)
- tests for Facts produced by findcall and pkgfacts.
  (Findcall now produces facts just for testing.)
- Add String method to various Fact types.
  Should the Fact interface have this method?

Change-Id: Ifa15fbd49d6ec3042b5fe9d3ebf22f4bdfdc8769
Reviewed-on: https://go-review.googlesource.com/139157
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-03 17:40:11 +00:00
Bryan C. Mills
9fb5a2f241 all: set GO111MODULE=off for tests that use GOPATHs in testdata.
Some users may set GO111MODULE=on, and we will eventually want to be able to
build x/tools itself in module mode.

Updates golang/go#27858
Updates golang/go#27852

Change-Id: Iaf488b2a89e6526471530245cb580f1f0391a770
Reviewed-on: https://go-review.googlesource.com/137815
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-03 17:21:27 +00:00
Rebecca Stambler
9599141856 go/packages: add ErrorKind field to differentiate error sources
Some applications (for example, diagnostics shown to a user in an
editor) may want to distinguish between errors generated by
the driver, parser, and type-checker. The Error struct did not have any
mechanism for doing this, so add an ErrorKind field and set it in
appendError.

Change-Id: If347163225d1e3a567e98610e9ba8a0930e4659c
Reviewed-on: https://go-review.googlesource.com/139317
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-03 17:20:41 +00:00
Michael Matloob
c930a8531d go/packages: remove code that skips two tests for Go 1.10
TestLoadImportsC just works on Go 1.10. And there's no good reason
that TestLoadAllSyntaxImportErrors shouldn't work, even though
it's currently always skipped.

Change-Id: Icd8d311f12c5731cc635937a00251eab0a3077ec
Reviewed-on: https://go-review.googlesource.com/139117
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-03 16:44:45 +00:00
Michael Matloob
34d7740906 gopackages: don't make .go files relative to search path
A previous change (golang.org/cl/137096) that made absolute package paths relative to
GOROOT or GOPATH entries also accidentally applied to .go filesnames.
Filter those out of the list of paths considered to make relative to
search path.
(package paths that don't start with './' or '/' are relative to GOROOT or GOPATH,
but filenames are not.)

Change-Id: I67fbd0e5caa7e53f3ab5b77f55d6841fe2132578
Reviewed-on: https://go-review.googlesource.com/c/138880
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-03 16:43:57 +00:00
Michael Matloob
cb0b336180 go/packages: pass through packages with error in the fallback
This applies a part of golang.org/cl/137075 to the fallback. If go list
doesn't find a package, it returns an almost empty package structure
with an error set on it. That change passed through those packages
from the 1.11+ go list, so users could determine there wasn't a match.
This change does the same from the go 1.10 fallback go list code.

Change-Id: I98acc186c0a9eeef0416e9fec0e1fe0e29ddc51c
Reviewed-on: https://go-review.googlesource.com/c/139158
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-03 16:43:08 +00:00
Chris Broadfoot
2f84ea8ef8 cmd/godoc: move regression tests to a go test
Run them separately from the other tests in godoc_test by requiring a
regtest.host flag and by filtering on the test name.

Updates golang/go#27205.

Change-Id: I166d2278a3f6954307f7c935567a81e73f78e7bb
Reviewed-on: https://go-review.googlesource.com/c/139238
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-03 02:47:31 +00:00
Chris Broadfoot
390954b1ab cmd/godoc: re-enable host checking, allow test versions
test.golang.org is no longer -- instead allow access to version-specific
App Engine URLs (like 20181002t1342-dot-golang-org.appspot.com).

App Engine Flex uses the X-Forwarded-Proto to signify the proto used by
the originating request (it always uses h1 on 8080 when proxying the
request).

Updates golang/go#27205.

Change-Id: I423ffe65df325500a2fa04c7b655797ecc6ad037
Reviewed-on: https://go-review.googlesource.com/c/139237
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-03 01:52:03 +00:00
Chris Broadfoot
bdd8ae38fd cmd/godoc: improve deployment scripts, add buildinfo
* Build Go from a given version (make.bash)
* Add a /buildinfo file that describes the inputs of the
  build/deployment.
* Use Makefile/environment variables to override Go version and
  Docker tag.

Updates golang/go#27205.

Change-Id: Ia7a88b75f9d5b2319d2381e56bc963eb53e889c7
Reviewed-on: https://go-review.googlesource.com/c/138978
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-02 23:13:01 +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
Rebecca Stambler
8deeabbe2e internal/lsp: support range formatting
Refactor code a bit to support range formatting as well document
formatting. Also, separate view from server to clean up.

Change-Id: Ica397c7a0fb92a7708ea247c2d5de83e5528d8d4
Reviewed-on: https://go-review.googlesource.com/138275
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-01 16:29:50 +00:00
Alan Donovan
792c3e655c go/types/objectpath: fix tests for pre-go1.11
The behavior of go/types.ObjectString (or perhaps the underlying
object) changed at some point.

Change-Id: I77f1d13c180e1f78ddc08e80e5d38aa01f425111
Reviewed-on: https://go-review.googlesource.com/138777
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-10-01 16:20:35 +00:00
Alan Donovan
b3c0be4c97 go/ast/inspector: faster (amortized) AST traversals
This new package provides helper functions for traversal over the
syntax trees of a package, including node filtering by type, and
materialization of the traversal stack.

During construction, the inspector does a complete traversal and
builds a list of push/pop events and their node type. Subsequent
method calls that request a traversal scan this list, rather than walk
the AST, and perform type filtering using efficient bit sets.

Experiments suggest the inspector's traversals are about 2.5x faster
than ast.Inspect, but it may take around 5 traversals for this benefit
to amortize the inspector's construction cost.

This design is well-suited to the ongoing reworking of cmd/vet (see
docs.google.com/document/d/1-azPLXaLgTCKeKDNg0HVMq2ovMlD-e7n1ZHzZVzOlJk),
which historically made a single pass over the ASTs but is being
replaced by a design that requires a separate pass for each analysis.

Change-Id: I9a67aed6a3bf948076641d96447860d97ede67b4
Reviewed-on: https://go-review.googlesource.com/135655
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-09-28 18:13:43 +00:00
Michael Matloob
16720d5f2d go/packages: allow absolute paths when using the fallback
Another change to bring the go1.10 fallback's functionality in line with
the go1.11 go list implementation. The fallback now uses go env to
determine GOPATH and GOROOT and searches them to see if any match an
absolute path, and if so trims the GOPATH/GOROOT entry off  the start
of the path.

Fixes golang/go#27734

Change-Id: Ibd2313fc4301d42fd8c0cd98f1f3e7a313d65eb7
Reviewed-on: https://go-review.googlesource.com/137096
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-09-28 17:53:27 +00:00
Alan Donovan
51aacb1402 go/analysis: add command-line help
The format of Analyzer.Doc is now specified as a short title followed
by a longer description. This allows us to build a nice
self-documenting command-line interface. Much of the documentation in
vet's doc.go and file-level comments can now be displayed to the user.

Change-Id: I462343e97ac9b743284aaa3e06e7a81d11e9593f
Reviewed-on: https://go-review.googlesource.com/138396
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-28 16:51:45 +00:00
Alan Donovan
7b71b077e1 go/analysis/analysistest: refuse to analyze zero packages
It's easy to forget to pass the last argument,
in which case the test would silently pass.

Change-Id: I95249e1fe8bee75cfaa535fcf723d04f102214fc
Reviewed-on: https://go-review.googlesource.com/138395
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-28 16:40:45 +00:00
Agniva De Sarker
ae8529dc16 godoc/vfs/zipfs: join paths to get correct RootType
The logic was incorrectly written from vfs/os.go. zipfs filesystem
passes actual paths during dirTree building. So we need to join the paths
to determine whether they are under GOROOT or GOPATH.

Updates golang/go#27205

Change-Id: Ic4330fce02c6ebfc44ae21122e2412c33f0cd45a
Reviewed-on: https://go-review.googlesource.com/138435
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-28 16:24:37 +00:00
Alan Donovan
73ed285d4c go/types/objectpath: a stable naming scheme for types.Object
Type-checker objects are canonical, so they are usually identified by
their address in memory (a pointer), but a pointer has meaning only
within one address space. By contrast, objectpath names allow the
identity of a logical object to be sent from one program to another,
establishing a correspondence between types.Object variables that are
distinct but logically equivalent.

This package was developed for Google's internal fork of guru.
It is needed for lemma support in the analysis API; see
docs.google.com/document/d/1-azPLXaLgTCKeKDNg0HVMq2ovMlD-e7n1ZHzZVzOlJk

Change-Id: I9899ce14d57909858a68f84e90d58a039f2bb7a0
Reviewed-on: https://go-review.googlesource.com/135675
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-09-28 15:15:07 +00:00
Bryan C. Mills
84988e2dba go/packages: do not error out for patterns that match no packages
The documentation for Load says:
“Load returns an error if any of the patterns was invalid as defined
by the underlying build system. It may return an empty list of
packages without an error, for instance for an empty expansion of a
valid wildcard. Errors associated with a particular package are
recorded in the corresponding Package's Errors list, and do not cause
Load to return an error.”

Therefore, it should not be an error for a pattern to match no
packages. If the pattern is a literal package path that does not
exist, we should prefer to return a *Package for it with an error in
the Errors field.

Change-Id: Iaecfb920097e3b520e763bd52c0e326d2e7a4861
Reviewed-on: https://go-review.googlesource.com/137075
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-28 12:33:17 +00:00
Chris Broadfoot
e9ca907325 cmd/godoc: simplify dev and prod environment for App Engine
Remove all of the code generation and the concept of "APPDIR" - just
generate godoc.zip and index files in the app directory.

Simplify generation of the zip - use a symlink so that every file in
godoc.zip is under the "goroot" directory, regardless of the
environment. Previously, the prefix would be dependent on the location
of the user's GOROOT.

Running the setup script is now optional - it's now possible to run
dev_appserver.py on a regular checkout of cmd/godoc without godoc.zip
and search index files. Use environment variables to switch whether the
zip file is used vs reading GOROOT from the filesystem.

Change-Id: I1ce95c891717fe2da975f979778fd775b23f18c8
Reviewed-on: https://go-review.googlesource.com/46725
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-09-28 11:54:07 +00:00
Alan Donovan
1be7b45b4c go/analysis/passes/vet: fork cmd/vet@31d19c0
This change creates a fork of vet from the standard distribution.

It was created by this script:

 $ mkdir go/analysis/passes/vet/
 $ cd go/analysis/passes/vet/
 $ (cd $GOROOT/src/cmd/vet >/dev/null && git co 31d19c0 && tar cf - .) | tar xf -
 $ rm -fr all              # We'll deal with cmd/vet/all later.
 $ rm -fr internal/cfg     # Published as golang.org/x/tools/go/cfg.
 $ sed -i -e '1s?^?// +build ignore\n\n?' *.go

All the Go files have been tagged "ignore" for now.
A series of follow-up changes will convert each vet check
into an instance of the new go/analysis API's Analyzer.

At some point soon, cmd/vet in the standard distribution will use a
vendored copy of this code. Until then we will periodically integrate
any changes made to cmd/vet to this fork. The current version of
cmd/vet will be recorded in the REVISION file.

Change-Id: I0c63eeb17cc612b3f013679595dcbc71a90950f7
Reviewed-on: https://go-review.googlesource.com/138137
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-27 19:02:35 +00:00
Alan Donovan
b41e4b469b go/analysis: add Pass.OtherFiles field
This field lists the names of non-Go files that are part of the
package under analysis.

Change-Id: Ic967dc18b98e018c691442f7378cb29db30a1454
Reviewed-on: https://go-review.googlesource.com/138136
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-27 17:26:44 +00:00
Rebecca Stambler
d457fc8054 cmd/golsp: support formatting in golsp
This commit adds support for some basic commands necessary for
integration with VSCode. It also adds support for the
"textDocument/format" method.

Change-Id: I8fd0e33ca544ab65d3233efe2fef9716446ad4ff
Reviewed-on: https://go-review.googlesource.com/138135
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 17:02:42 +00:00
Alan Donovan
308f0c7c09 go/analysis: revert UsesFacts to FactTypes
Forcing clients to register their Fact types with gob made for an
unfriendly API. Now the driver is again responsible for doing it.

The FactTypes field is now a slice of Fact values (not reflect.Types)
used only for their dynamic type, which is slightly more convenient.

Change-Id: I01219edb24bd2371ba642bb56508aa80c19a9b61
Reviewed-on: https://go-review.googlesource.com/137836
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-27 16:40:32 +00:00
Ian Cottrell
ef04bbebd8 cmd/golsp: An empty shell of an lsp server for the go language
Change-Id: I51ef556048c2d10537ad90fa5284939e09bc31fd
Reviewed-on: https://go-review.googlesource.com/137097
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 15:24:00 +00:00
Robert Griesemer
9e2f8b2a0a go/internal/gccgoimporter: remove special case for Go1.9
The supported x/tools versions are now all at least Go1.9.

Change-Id: I9476329f2be8f3c560efb280f06d65669a3e9f85
Reviewed-on: https://go-review.googlesource.com/137996
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 15:01:54 +00:00
Robert Griesemer
b14f328a62 go/internal/gccgoimporter: port recent changes from stdlib version
This CL brings over the following changes from the std lib:

	https://golang.org/cl/137857
	https://golang.org/cl/137935
	https://golang.org/cl/137975

There are no further code changes except that the importer test
cases are split between importer_test.go and importer19_test.go
to support multiple Go versions.

Updates golang/go#27856.

Change-Id: I625def738c22c24c6659af37c3871038fdd8b981
Reviewed-on: https://go-review.googlesource.com/137995
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-27 04:48:12 +00:00
Alan Donovan
ef4a2a23bb go/analysis/analysistest: fix tests on MS Windows
CL 137735 only fixed Darwin, and was submitted prematurely.

Change-Id: Idf9706ab2dc6ef716471cd6a2089bb0be63a54a2
Reviewed-on: https://go-review.googlesource.com/137835
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-26 20:30:08 +00:00
Alan Donovan
34cd4017e8 go/analysis/analysistest/analysistest: fix test on non-Linux
The test's pathname sanitization heuristically assumed that $TMPDIR
contained /tmp, which is not the case on Darwin or Windows. Now we
pass it the precise directory prefix to strip off.

Fixes golang/go#27877

Change-Id: I85167d721ebb9c4f6d74016a00025fd726939e47
Reviewed-on: https://go-review.googlesource.com/137735
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-26 20:13:27 +00:00