1
0
mirror of https://github.com/golang/go synced 2024-11-18 21:44:45 -07:00
Commit Graph

2823 Commits

Author SHA1 Message Date
Alan Donovan
d777022dd8 go/analysis/passes/structtag: split out from vet
Change-Id: Ib3c4c783e4bca2bf2b3c76bea8f19959b7e39539
Reviewed-on: https://go-review.googlesource.com/c/142097
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-15 21:04:11 +00:00
Alan Donovan
8919434dde go/analysis/passes/copylock: add workaround for go1.10
CL 121876 made sync.noCopy implement sync.Locker and
added this as an assumption to vet.  But now that copylock
is no longer in the standard library it cannot
assume that it is analyzing a recent standard library
in which noCopy has an Unlock method.

Change-Id: I5a30b3711ae6cc0855eb246fdd93b1906779bdde
Reviewed-on: https://go-review.googlesource.com/c/141683
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-15 20:10:34 +00:00
Alan Donovan
cdd5f6199c go/analysis/passes/printf: add types.go too
This file is nominally part of the core vet tool but in reality it is
only used by the printf checker.

This is just a rename; the actual change will come in a follow-up.

Change-Id: I5497d6888228e6781cf0d3ae62b7c6b5b723e151
Reviewed-on: https://go-review.googlesource.com/c/142240
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-15 19:52:40 +00:00
Alan Donovan
104357fe96 go/analysis/passes/printf: move printf to correct subdirectory
Change-Id: I9c510fe042461707a47d8ba4fb4f70c33efbc8cc
Reviewed-on: https://go-review.googlesource.com/c/142238
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-15 19:19:59 +00:00
Alan Donovan
25a9b7c729 go/analysis/passes/printf: create printf pass
This is a straight rename to simplify review of the actual change in a
follow-up CL. (This is a workaround for git diff's weak support for
renames.)

Change-Id: If63336d4f782e12066fce83a848465371013cdde
Reviewed-on: https://go-review.googlesource.com/c/142237
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-15 19:09:06 +00:00
Alan Donovan
aa46a01996 go/ssa/ssautil: add AllPackages method
In go1.10, go/packages falls back to loading all packages
from source but not typechecking function bodies for imports.
The ssautil.Packages function would nonetheless provide
the partially-typed ASTs to the SSA builder, which would crash.
Now Packages only passes syntax trees to the SSA builder for
the initial packages, which are the only ones guaranteed to be
fully typed.

It is impossible to discern whether the caller of Packages intends to
build SSA code for dependencies, as in some clients such as
cmd/callgraph, so we add a new function, AllPackages, that expresses
this intent.

Fixes golang/go#28106

Change-Id: I6a88b7c7545e9de90b61f5bee0e6de3d2e21b548
Reviewed-on: https://go-review.googlesource.com/c/141686
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-15 18:41:29 +00:00
Michael Matloob
4b6ee5fb87 go/packages: remove scary warning on documentation
Add a guarantee for breaking changes.

Change-Id: I7c176eb0c3a309ad187e3a33a645996e397d09be
Reviewed-on: https://go-review.googlesource.com/c/141684
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-15 17:50:52 +00:00
Michael Matloob
13ebad898d go/packages: use "=" instead of ":" for special queries
This change updates the language accepted through the arguments
to packages.Load to make it more consistent. There are now two layers.
A pattern containing an "=" is considered to be a special query, and the
part of the pattern up to the first "=" is considered the query type. All
other patterns are to be interpreted as the build system interprets it.
For now two special queries exist. file= has the behavior that contains:
did: finding packages containing the given file. The query type pattern=
is used to pass through a pattern to be interpreted by the build system.
pattern= is a type of escaping to allow passing through patterns that
contain an "=" to be interpreted by the underlying buildsystem. To allow
for new query types to be introduced, packages.Load will report an
error if the qury type is not understood. We expect name= to be added in
an  upcoming change.

"contains:" changes to "file=". A new

Change-Id: I1b208d1c998c67d5556cdc872d7694273cedb7e4
Reviewed-on: https://go-review.googlesource.com/c/141681
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-15 17:42:17 +00:00
Yuval Pavel Zholkover
5e66757b83 internal/fastwalk: don't cross Dirent.Reclen boundry while looking for NULL in parseDirEnt
Crossing Dirent.Reclen boundry was manifested in golang/go#28131 as garbaled filenames,
when Dirent.Name was not NULL terminated on FreeBSD due to a bug (parseDirEnt would find a NULL
in the following Dirent's Fileno/Reclen fields).

Only search for NULL on linux, when the Namlen field is available use it directly instead.

Updates golang/go#28131

Change-Id: I64090576c8bad2bd246d1561432bf73d5caee2a9
Reviewed-on: https://go-review.googlesource.com/c/141801
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-13 18:20:35 +00:00
Andrew Bonventre
13216ffa54 cmd/present: address minor comments not applied in a previous change
These changes were suggested in golang.org/cl/140841 but were not
applied in that change. They are small documentation fixes and a
switch from using fmt.Fprintf/os.Exit to log.Fatalf.

Change-Id: I9393261f8f28b589678866dd7b8904d46629fb4b
Reviewed-on: https://go-review.googlesource.com/c/141685
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-10-13 14:52:46 +00:00
Alan Donovan
c0eb142035 go/analysis/passes/asmdecl: fix a panic under go1.10
Now that asmdecl is not in the standard repo, we must not assume
that types.SizesFor knows about all architectures and panic if it
does not. This change makes it print a warning and assume 64-bit
norms.

Change-Id: Idacad350b2fc9343adfb32539fec7003b39380ed
Reviewed-on: https://go-review.googlesource.com/c/141679
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-12 20:14:14 +00:00
Heschi Kreinick
d1d6d0cbb6 imports: refactor tests
We plan to change goimports to use go/packages, which requires changing
its internal design. Having tests use the external interface makes those
changes easier. After this change almost all testing is through Process.

Broadly speaking, the changes are:

- Switch to subtests wherever possible. This involved making up many
names, which I hope are accurate.

- Convert tests that used findImport directly to use Process instead.
This often made them slightly larger but not unduly IMO.

- Replace simple tests with entries in the giant table at the top.

- Remove uses of custom goroots, which are troublesome for
go/packages' use of the go command. Almost none of them were actually
necessary. I left one in TestGoRootPrefixOfGoPath; I'm not sure how
to handle it yet.

Change-Id: I7b810750f72842b58223f102097ccbb51b82bf39
Reviewed-on: https://go-review.googlesource.com/c/140840
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 19:02:34 +00:00
Heschi Kreinick
19e2aca3fd internal/gopathwalk: create
Extract goimports' logic for walking Go source directories into a
separate package, suitable for use in go/packages. No functional
changes. Added a convenience feature to fastwalk, allowing the user to
say that they're done with a directory and stop receiving callbacks for
it.

Testing is a little light; I expect goimports' tests to cover most
everything we care about.

Change-Id: If047ada4414f5f282637d11fd07e8342fadc9c33
Reviewed-on: https://go-review.googlesource.com/c/138877
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 18:13:39 +00:00
Heschi Kreinick
1d07bcb7f9 imports: refactor directory walking
We plan to reuse goimports' directory walking logic in the
implementation of go/packages. To prepare for that, refactor it to have
fewer global variables and a simpler interface.

This CL makes no functional changes, but may change performance
slightly. It always scans both $GOPATH and $GOROOT, and does so
serially. I expect that fastwalk's internal parallelism is enough to
keep the disk busy, and I don't think it's worth optimizing for people
hacking on Go itself.

Change-Id: Id797e1b8e31d52e2eae07b42761ac136689cec32
Reviewed-on: https://go-review.googlesource.com/c/135678
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 17:53:56 +00:00
Serhii Aheienko
12a7c317e8 imports: support repairing import grouping/ordering
The existing implementation detects import groups and tryies to
sort/regroup only the last one. Ignore existing grouping and
applying the sort function to all imports fix this.

Fixes golang/go#20818

Change-Id: I5db46c6dc8fabd9299b79349880994be5c1b8195
Reviewed-on: https://go-review.googlesource.com/c/116795
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 15:41:53 +00:00
Alan Donovan
87312bc3ed go/packages: use effective GOARCH to determine type size function
The typechecker's Sizes function is not currently set correctly.
The correct answer requires information known only to the build
system's query tool (go list, blaze query, etc), and we need to
add a mechanism for it to return this information.

In the meantime, we use this simple workaround: if the GOARCH
environment variable is set, we use that to determine sizes according
to the conventions of gc. Otherwise, we use the architecture for which
the application was compiled. Both could easily be incorrect, but this
is nonetheless progress.

This change should fix the tests of go/analysis/passes/shift,
which are currently broken for GOARCH=386 because the analysistest
driver uses go/packages, which ignores GOARCH.

Change-Id: Iabe3211ad513a9a94eadd6d8f4b2068f7abdd053
Reviewed-on: https://go-review.googlesource.com/c/141757
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-12 12:58:16 +00:00
Chris Broadfoot
d3c6139142 cmd/godoc: synchronously init corpus for index mode
The corpus needs to be init'd before generating the index.

Regression caused by CL 141397.

Updates golang/go#25443.

Change-Id: I04d19bf5d279031cc8ddf0f850d81eb06fc5efa8
Reviewed-on: https://go-review.googlesource.com/c/141717
Run-TryBot: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 23:40:14 +00:00
Alan Donovan
157aeed469 go/analysis/passes/ctrlflow: add test of modularity
See the Modularity section of the design doc:
https://docs.google.com/document/d/1-azPLXaLgTCKeKDNg0HVMq2ovMlD-e7n1ZHzZVzOlJk#heading=h.s7mcpao0dpqu

Change-Id: I83e6df01691964703a07a47c222101f3307a0dc6
Reviewed-on: https://go-review.googlesource.com/c/140759
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-11 20:48:43 +00:00
Alan Donovan
8149dec50d go/analysis: validate: report duplicates among analyzers (roots)
Duplicate root analyzers caused duplicate flag registration and other problems.

Change-Id: Id0c2761529c57ed1f9a63b669e62401ebf035cc2
Reviewed-on: https://go-review.googlesource.com/c/141159
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-11 19:55:00 +00:00
Koichi Shiraishi
be3ddffac4 cmd/guru: fix several functions godoc comment prefix
The several functions not exported, Use "The xxx function ..." rule.

Change-Id: Iaba2490b4a9675213f70d055bd9ded9e5a245aa5
Reviewed-on: https://go-review.googlesource.com/c/47872
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-11 18:05:12 +00:00
Alan Donovan
6979e85b73 go/analysis/passes/shift: split out of vet
Change-Id: I9c0c86e7aee4f7bb9239dc4b4836df9bba471b03
Reviewed-on: https://go-review.googlesource.com/c/140757
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-11 18:00:20 +00:00
Alan Donovan
a398e557df go/analysis/passes/cgocall: split out of vet
This checker needed some reworking because whereas vet sees
unprocessed cgo source files (with partial type information), the
analysis API sees cgo-processed files with complete type information.
However, that means the checker must effectively undo some of the
transformations done by cgo, making it more fragile during changes to
cgo.

Change-Id: I3a243260f59b16e2e546e8f3e4585b93d3731192
Reviewed-on: https://go-review.googlesource.com/c/141157
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-11 15:25:55 +00:00
LE Manh Cuong
1f849cf54d cmd/godoc: do not use httptest
httptest assumes it's running a test, it registers its own flags, which
means godoc ends up with mysterious flags.

By implement an http.ResponseWriter, we do not need to use httptest.

Fixes golang/go#28138

Change-Id: Ia0de8597c3edb0e7bdea6d8b3b2f1618a12f9239
Reviewed-on: https://go-review.googlesource.com/c/141417
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 04:24:14 +00:00
Agniva De Sarker
c75e7e6983 godoc: inject treeview content only when needed
- This shaves off 12.8KB (unzipped) / 3.8KB (zipped)
downloadable data and around 6ms of javascript parse time
when the files are not injected.

- Also, conditionally rendering the callgraph html only when
callgraph is actually present.

- Removed the "text/javascript" attribute as it is the default
value now.

Change-Id: I70c030bdda2a054c181b2b3a693842bafed88d1a
Reviewed-on: https://go-review.googlesource.com/c/115875
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 02:39:00 +00:00
Kunpei Sakai
48cd23a0c8 godoc/static: get rid of ::-webkit-search-decoration of #search
The input[type="search"] has a pseudo element,
it's ::-webkit-search-decoration and has an original margin.

To get rid of the margin, this commit specifies -webkit-appearance
property to none.

Fixes golang/go#27210

Change-Id: I09bbae5e0b811a3b3fa3a047b97ea45190e75f46
Reviewed-on: https://go-review.googlesource.com/c/131317
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 02:36:07 +00:00
Brad Fitzpatrick
e5fe289229 godoc, cmd/godoc: remove CLI support
godoc is now just a webserver (the one that runs golang.org)

A future change might rename this to something else, but not now.

Fixes golang/go#25443

Change-Id: Ib95d0589e13f4c7a717ff28d694f1472e427eef4
Reviewed-on: https://go-review.googlesource.com/c/141397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-10-11 02:31:40 +00:00
Andrew Gerrand
0e57ebad1d godoc/static: prevent menu "bouncing" when showing Play button
The code as written would use JavaScript to show the "Play" button in
the menu when the Playground is enabled, making the button appear
after the page first renders, causing a visible "bounce" in the menu.
This change checks the condition (whether this is not the front page, or
"wide") in the template code, instead of with JavaScript after the page
has loaded.

Change-Id: Iccf0a344116372f3207158793be8c7734e67a4ae
Reviewed-on: https://go-review.googlesource.com/c/140798
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-10-11 02:11:41 +00:00
Alan Donovan
38981630ec go/analysis/passes/tests: split out from vet
The analysistest.Run function now applies a single analysis to
a set of packages, not just one, as this is necessary for testing
the "tests" Analyzer.  The Run function also returns a richer
Result for each package, allowing a test to perform additional
checks if necessary.

I really don't understand how Gerrit decides whether to render
a file such as passes/tests/tests.go as a mv+edit or an add;
small changes to the CL seem to perturb the heuristic.
When reviewing these CLs please inspect the logical diff of
 passes/vet/tests.go -> passes/tests/tests.go

Change-Id: I7812837278b20c8608ccbb6c709c675588a84db1
Reviewed-on: https://go-review.googlesource.com/c/140457
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-10 21:46:53 +00:00
Andrew Bonventre
37fd46feae cmd/present: merge appengine and non-appengine files
Without changing the behavior of the present command for local
usage (using the local socket for running examples, defaulting to
the current directory for all content). Add flags and set them to
the appropriate values if running on App Engine.

Notably, since the Go files must be in the same directory as
app.yaml, the content root must be ./content/ to avoid listing
the present source files.

It also defaults to running example snippets via the HTTPTransport
(https://play.golang.org/compile) instead of locally when on App
Engine.

There are also some small cleanup code changes.

Update golang/go#28080

Change-Id: I40bb7923107614f88d2bfdffd34a824d4bacb3a1
Reviewed-on: https://go-review.googlesource.com/c/140841
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-10 21:11:20 +00:00
Alan Donovan
f78a1e9345 go/analysis/passes/composite: split out of vet
Change-Id: Ie6e05bea1c8c607407479f5f45dea6fcec62f60c
Reviewed-on: https://go-review.googlesource.com/c/140739
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-10 18:59:35 +00:00
Alan Donovan
34804b1db3 go/analysis/passes/unsafeptr: split out from vet
Change-Id: Ic5f41b62b4539709f83d9a960f0ab6b87dd2092c
Reviewed-on: https://go-review.googlesource.com/c/140758
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-10 18:29:10 +00:00
Alan Donovan
fe0886716e go/analysis/passes/nilfunc: split out of vet
Change-Id: Ibbe8dfddfcabd2bb71753c969eef14f92603c17d
Reviewed-on: https://go-review.googlesource.com/c/140762
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-10 17:27:10 +00:00
Alan Donovan
06b1b3f6e3 go/analysis/passes/bools: split out of vet
And rename from "bool" to "bools".

Using analysistest unearthed a minor bug,
github.com/golang/go/issues/28086.
To avoid complicating the diff we work
around it in the tests for now.

Change-Id: I682f33506de778dfdfe97841cd2b16e3d47062b8
Reviewed-on: https://go-review.googlesource.com/c/140737
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-10 17:25:13 +00:00
Alan Donovan
3f6d6d9ddd go/analysis/passes/atomic: split out of vet
Also: don't abort loading just because there were parse/type errors.
It's the driver's job to decide whether to fail due to errors.

Change-Id: I055033fb89319d957b328c4fa4a30144afc7457c
Reviewed-on: https://go-review.googlesource.com/c/140738
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-10 17:23:52 +00:00
Chris Broadfoot
65a9b9c4ab cmd/godoc: add missing Dockerfile ARG
Also moves the ARG declarations immediately before they're used to
make this omission less likely for future additions.

Change-Id: Id52a936d978f96d3c629feff69fc9dc4ae1b8463
Reviewed-on: https://go-review.googlesource.com/c/140377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-10 15:29:03 +00:00
Andrew Bonventre
29f11e2b93 playground: use play.golang.org instead of golang.org
Calling golang.org/{compile|share} just forwards it to
play.golang.org/{compile|share}. Avoid the extra jump for the
request.

Change-Id: I95e8e79fe4623346663d0c11204f196c75716177
Reviewed-on: https://go-review.googlesource.com/c/140839
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-10-10 00:07:25 +00:00
Andrew Bonventre
9ae4309624 playground: set content-type header on non-appengine builds
Currently, when a POST request is made using code with build tag
+build !appengine it doesn't set the content-type header passed
to the function. This was breaking the case where a url-encoded
body (a code snippet's body and protocol version) was being POSTed
to golang.org/compile since it never set the content-type of the
request and the corresponding form values parsed out were empty as
a result.

Update golang/go#28080

Change-Id: I677ca01b2f5aecedbd13d1faa7a838ddc0199244
Reviewed-on: https://go-review.googlesource.com/c/140838
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-10-10 00:03:39 +00:00
Alan Donovan
afb03721b5 go/analysis/passes/unreachable: split out of vet
Change-Id: Ibbc888ee86de1cc59392b258ec32d2aec3b9fbef
Reviewed-on: https://go-review.googlesource.com/c/140837
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-09 19:57:44 +00:00
Alan Donovan
088df9ca28 go/analysis/passes/unusedresult: split out of vet
Change-Id: I4bdba827ab0a518d62dda85cfc66875a54aeda24
Reviewed-on: https://go-review.googlesource.com/c/140760
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-09 19:37:37 +00:00
Alan Donovan
dd8190d4c7 go/analysis/passes/stdmethods: split check out of vet
Also, rename to stdmethods and add more tests.

Change-Id: I09b65899dc02a8062f3ec1d909c2eae45472e236
Reviewed-on: https://go-review.googlesource.com/c/140761
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
2018-10-09 19:21:15 +00:00
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