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

1689 Commits

Author SHA1 Message Date
Alan Donovan
2477c0d578 x/tools/...: fork and tag !1.5 all files that use go/types et al
This change will ensure that the tree continues to work with go1.4.1.

All files continue to depend on golang.org/x/tools/go/types, but in a
follow-up change, I will switch the primary files to depend on the
standard go/types package.  Another (smaller) set of files will be
forked and tagged, this time !1.6, due to API differences between the
two packages.

All tests pass using 1.4.1, 1.5, and ~1.6 (tip).

Change-Id: Ifd75a6330e120957d646be91693daaba1ce0e8c9
Reviewed-on: https://go-review.googlesource.com/18333
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 20:40:09 +00:00
Alan Donovan
8f90b5e560 go/ssa/interp: remove stale TODO
Followup to TBR'd change https://go-review.googlesource.com/#/c/18191/.

Change-Id: I7d6957a46aea00cfe0b734576b5392d578ee06d9
Reviewed-on: https://go-review.googlesource.com/18326
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-06 19:24:01 +00:00
Alan Donovan
c49318f04a go/ssa/interp: make os.Pipe intrinsic POSIX-portable; disable on Windows
Change-Id: I6c2f495c7c75f86590a0d79f86423ca67d695347
Reviewed-on: https://go-review.googlesource.com/18325
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 19:21:02 +00:00
Alan Donovan
0f870d4d86 go/loader: fix interaction of cwd and vendor
Packages specified on the command line should be interpreted relative to
cwd iff they are local (e.g. ./http within $GOROOT/src/net), otherwise a
request for, say, "golang.org/x/net/http2/hpack" might return the vendored
package depending on the working directory.

The FindPackage hook function now takes a build.ImportMode parameter, so
it matches the signature of (*build.Context).Import.  The AllowVendor
flag is enabled only for imports within source files, but not for the
initial packages.

+ test.

Change-Id: I756dc46b70928d2fd9f824e6670092d8169e0d64
Reviewed-on: https://go-review.googlesource.com/18318
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 18:28:16 +00:00
David R. Jenni
e7d14dfe5b refactor/rename: fix crash when renaming type embedded in another package.
Fixes golang/go#12038.

Change-Id: I9026edef7f8769b451f2b1502c107d6b2bb45096
Reviewed-on: https://go-review.googlesource.com/13451
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-05 17:28:30 +00:00
Andrew Gerrand
a8498a77d5 godoc: hide appengine dependencies behind build tags
Fixes the continuous build.

Change-Id: If55b08c3b702ba705d84a30fdbce842438477883
Reviewed-on: https://go-review.googlesource.com/18241
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-04 23:08:03 +00:00
Alan Donovan
2dff1e88eb oracle: referrers: fix crash when loading nonexistent files
Files with //line directives may not exist.
Print a helpful error instead of panicking when a file fails to load.

+ Test.

Fixes issue #13459

Change-Id: I305d1380e66e64d20ea84a27c284f53c019fe5e6
Reviewed-on: https://go-review.googlesource.com/18209
Reviewed-by: Michael Matloob <matloob@golang.org>
2015-12-30 22:01:27 +00:00
Alan Donovan
3a85b8da38 refactor/importgraph: reduce I/O concurrency to avoid EMFILE
Use an concurrency-limiting semaphore to reduce I/O parallelism in Import.

Also, start the producer in a new goroutine so that it runs in parallel
with the consumer.  Paradoxically, this reduces the peak number of
goroutines.

Also, in buildutil.ForEachPackage, make the concurrency limiting
semaphore global, since I/O parallelism is a process-wide resource.

Change-Id: I282b717c50603361826e5675077c9f464c874132
Reviewed-on: https://go-review.googlesource.com/18215
Reviewed-by: Michael Matloob <matloob@golang.org>
2015-12-30 22:01:03 +00:00
Alan Donovan
6e2f52e572 refactor/importgraph: document some optimization experiments
Change-Id: I5ea8f097814cd83a8534be1bfbeda4ebdabee168
Reviewed-on: https://go-review.googlesource.com/18216
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-30 20:26:04 +00:00
Alan Donovan
22501a76a1 oracle: describe: fix crash on bad ImportSpec
+ Test

Fixes issue #13380

Change-Id: I6d738756017f83a296bde6a04845cd985a351409
Reviewed-on: https://go-review.googlesource.com/18210
Reviewed-by: Michael Matloob <matloob@golang.org>
2015-12-30 20:24:55 +00:00
Alan Donovan
d331899c12 refactor/rename: add pid to name of temporary file for diff
Change-Id: Icd543062b4e1fe8c998f95c0daff5364f08ce83c
Reviewed-on: https://go-review.googlesource.com/18211
Reviewed-by: Ralph Corderoy <ralph.corderoy@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2015-12-30 17:21:38 +00:00
Alan Donovan
b2a7698651 go/loader: in stdlib_test, remove workaround for lack of vendoring
Change-Id: I058081ef596e8b5231321ef05d5256ec44cc58c6
Reviewed-on: https://go-review.googlesource.com/18214
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-30 16:37:28 +00:00
Alan Donovan
108b52ee61 cmd/gorename: -d flag prints diffs instead of rewriting files
The user may specify the diff tool using the -diffcmd flag.

+ test.

Also:
- eliminate redundant DryRun flag
- simplify Verbose messages using log.SetPrefix

Fixes issue #13355

Change-Id: I917edc73e31ddf0f5d5b9b30c43f826465529da1
Reviewed-on: https://go-review.googlesource.com/18208
Reviewed-by: Michael Matloob <matloob@golang.org>
2015-12-30 15:25:00 +00:00
Alan Donovan
a09dffbb6c go/vcs: workaround EOF bug in token-based XML decoder
...using same logic as in $GOROOT/go/src/cmd/go/discovery.go

See issue #13757

Change-Id: I2ace0abed0743f4a8675fa8780e190d640b57e6c
Reviewed-on: https://go-review.googlesource.com/18196
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-29 20:27:04 +00:00
Dmitri Shuralyov
157f8abbbd go/vcs: accept domain.root in RepoRootForImportDynamic
This is the same change as in https://golang.org/cl/12193.

Fixes golang/go#13506.

Related to golang/go#9357.

Change-Id: I9c7d956008641b1907e14bcb08198235f5f9552f
Reviewed-on: https://go-review.googlesource.com/18152
Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-29 15:00:21 +00:00
Alan Donovan
2b78567943 go/loader: fix tests to work at go1.5 and tip
Change-Id: Icc80f112a7ec4b64519220c57b6ccb2612166656
Reviewed-on: https://go-review.googlesource.com/18197
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-28 22:42:32 +00:00
Alan Donovan
b14dd1a5b7 go/importer: in TestImportStdLib, skip 2 packages that use vendoring
(See issue #13756)

Change-Id: Icda14c34f3460e941ae092f147432c795465a077
Reviewed-on: https://go-review.googlesource.com/18195
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-28 21:28:10 +00:00
Alan Donovan
9b7a39c6be go/loader: fix brittle example test
We need a better approach for tests such as these.

Change-Id: I6fb608acc096088fe377f6f2c40ff6124cf3d09c
Reviewed-on: https://go-review.googlesource.com/18194
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-28 21:24:47 +00:00
Alan Donovan
8463610142 go/ssa/interp: enable support for Example tests
1. Added intrinsic for os.Pipe to avoid use of "unsafe".  This makes
   Example tests work in the interpreter, fixing the broken "unicode"
   package (which recently sprouted some Examples) and allowing us to
   enable tests for:

      encoding/csv
      flag
      path
      text/scanner
      unicode/utf8

   The implementation of os.Pipe may require tweaking for non-Linux platforms.

2. Added intrinsic for strings.Index to avoid assembly dependency.

3. Added dumb intrinsic for testing۰runExample to work around a bug in
   go/ssa/testmain.go that requires an invasive fix
   (Until then, the output of Example functions will not be checked.)

Change-Id: I6374c9c47aa802275b7cdc98525e057f5db0615a
Reviewed-on: https://go-review.googlesource.com/18191
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-28 21:19:28 +00:00
Alan Donovan
e3e5aae018 go/types: in TestStdlib, skip 2 packages that use vendoring
(gcimporter does not support vendoring---see issue #13756)

Change-Id: Ief4101e4f33007d497ed1519845febfcffdded38
Reviewed-on: https://go-review.googlesource.com/18193
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-28 21:04:49 +00:00
Alan Donovan
f75338cbc6 go/types: skip two failing $GOROOT/test/fixedbugs tests
Change-Id: I7dfb95f34ae23c0b7905714b32068dc336a05656
Reviewed-on: https://go-review.googlesource.com/18192
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-28 19:40:50 +00:00
Alan Donovan
d6e83e534d go/loader: changes for vendor support
Prior to this change, the loader made the simplifying assumption
that an import path is equal to a package path, that is, a
subdirectory of src/.  (This assumption was already false because
relative imports "../foo" are possible, though discouraged.)
Now, an import "foo" may denote "a/vendor/foo" or "b/vendor/foo"
depending on whether it appears beneath a/ or b/.  Thus import
paths and package paths are no longer the same, and the directory
containing an import declaration is a necessary input to the
import resolution function.

This change makes the loader hygienic w.r.t. the directory of
each import declaration, and cleans up the terminology.
The only API change is to the FindPackage hook, which most
clients never use.

Details:
- Add a 'fromDir string' parameter to the FindPackage hook function.
- Add a dir field to each PackageInfo.
- doImport (called by go/types) now consists of two steps:
  use FindPackage(dir, importPath) to locate the package,
  then consult the import map using the canonical package path.
  Only the first step can fail.
- Memoize FindPackage.
- Simplify importInfo now that it no longer has to deal with errors.
  Replace a condition variable with a channel.
- Use a separate type to report importErrors.
- Rename loadAll to importAll
- Delete the importMode constant.
- Test.

Change-Id: I3defab51bfa12b48b1511a2172fb48dc8e9150e6
Reviewed-on: https://go-review.googlesource.com/18053
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-12-22 18:31:24 +00:00
Shenghou Ma
9673333889 godoc/dl: update label for ARMv6 binary distribution
See also golang/go#13669 and https://golang.org/cl/18059.

Change-Id: If958efc4a09082dad393df9a891f20921602320d
Reviewed-on: https://go-review.googlesource.com/18080
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-20 20:15:05 +00:00
Alan Donovan
fa833fdef5 refactor/importgraph: changes for vendor support
Each string in build.Package.{,Test,XTest}Imports must now be
interpreted relative to the Package.Dir.  This adds a ton of
redundant I/O.

Also:
- use a counting semaphore to limit concurrent I/O calls
  (Fixes golang/go#10306)
- remove obsolete call to runtime.GOMAXPROCS from the test.

Change-Id: Ic556c4cf41cce7a88c0158800c992e66f354c484
Reviewed-on: https://go-review.googlesource.com/18050
Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-18 20:17:50 +00:00
Alan Donovan
27534aa951 go/buildutil: changes for vendor support
Add AllowVendor constant for convenience across x/tools.
 (Will delete go/loader's importMode later)
Add StripVendor utility function + test.

Change-Id: I885076cb4ea67588996d85b749b85f49cd619f0d
Reviewed-on: https://go-review.googlesource.com/18049
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-12-18 20:00:43 +00:00
Alan Donovan
42bc1282f3 go/loader: update example_test for Go1.6
Change-Id: Ib3bf913e3c8f3cf06ba855f8dda855453e0a1aa2
Reviewed-on: https://go-review.googlesource.com/18048
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-18 18:15:14 +00:00
Alan Donovan
99c318c742 cmd/bundle: add blank line before package declaration
so that the bundled package doesn't clobber the package declaration
of the host package.

Also: minor comment tweaks.

Change-Id: I28ab3aca2b02213edc95c6b12c0d1a2514453cfe
Reviewed-on: https://go-review.googlesource.com/18040
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-18 13:56:53 +00:00
Chris Broadfoot
4a5fb9938b cmd/tip: add App Engine Managed VM health check handler
Change-Id: I67826efaa3cb2883771837581dd95aa9ec3e6d2b
Reviewed-on: https://go-review.googlesource.com/18025
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-18 02:25:12 +00:00
Chris Broadfoot
9532e1006b godoc: use ARMv6 as the label for arm6 builds.
Change-Id: I53c51fb772f23ab3f035b8e50bf017335d01e1c4
Reviewed-on: https://go-review.googlesource.com/18019
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-12-18 00:32:01 +00:00
Russ Cox
34ae141ecc go/loader: use build.AllowVendor during Import on Go 1.6 and later
Makes programs like ssadump work on packages using vendored code,
for example net/http.

For golang/go#12278.
Depends on CL 17726 in main repository.

Change-Id: Ibabf564e397044a0f449087124dd96161081baaf
Reviewed-on: https://go-review.googlesource.com/17727
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-12-17 20:34:07 +00:00
Brad Fitzpatrick
1cdaff4a02 go/types: fix build
Fixes golang/go#13603

Change-Id: Ie35094e9fd9976317340fae19425bffa307d7c8a
Reviewed-on: https://go-review.googlesource.com/17753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-14 01:42:23 +00:00
David Symonds
8297301f3a imports: Remove ancient Go 1.1 compatibility indirections.
Change-Id: Id389cba2d3696c3bd2c2987ddc1768059747e8ac
Reviewed-on: https://go-review.googlesource.com/17793
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-14 00:47:31 +00:00
David Symonds
e842f6af3a go/types: Remove ancient Go 1.1 compatibility indirections.
Change-Id: Ie16cc01ea2bd4806eaa7bd77cfbd2fa90f11ea36
Reviewed-on: https://go-review.googlesource.com/17792
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-14 00:47:24 +00:00
Alan Donovan
c0008c5889 x/tools/cmd/callgraph: add -ptalog flag
Since this tool is a handy way to run the pointer analysis during debugging.

Change-Id: If9a62f71dd8651ad6c782ead85bb84f09c703cba
Reviewed-on: https://go-review.googlesource.com/17382
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-12-04 17:49:28 +00:00
Chris Broadfoot
eb69368e05 godoc/dl: use datastore to retrieve secret key.
godoc still runs on App Engine (not Managed VMs). The metadata server is only
available from Compute Engine and Managed VMs, but not App Engine.

Change-Id: I0e5e9ef3f169f6d24ca7562df744c8f1556b825f
Reviewed-on: https://go-review.googlesource.com/17391
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-03 21:26:12 +00:00
Alan Donovan
b844739462 oracle: implements: inspect all packages in the analysis scope
If the analysis scope is not set, inspect all packages that depend on
the query package.

Fixes issue 13457

Change-Id: I08791d8a0a752470891ee93e65e664d0408525c5
Reviewed-on: https://go-review.googlesource.com/17342
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-12-02 22:28:52 +00:00
Alex Brainman
fff8fd7b19 go/buildutil: ignore path letters case in ContainingPackage on windows
Fixes golang/go#13368

Change-Id: I4cee2078bc64b6f175f206daa9609246cc1b1f85
Reviewed-on: https://go-review.googlesource.com/17211
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-11-25 03:21:30 +00:00
Alan Donovan
977844c7af go/ssa: fix crash when building map[*struct{}]bool{{}: true}
Since Go 1.5, if a key expression in a map literal is itself a composite
literal, the type may be omitted.  An & operation may be implied,
but was not generated, resulting in a type mismatch crash.

Added regression test.
Also, added missing intrinsic math.hasSSE4 to interpreter.

Fixes issue 13341

Change-Id: I6a5e560460cdcac295a500a3fc3738cbe8aa5853
Reviewed-on: https://go-review.googlesource.com/17123
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-11-23 19:08:17 +00:00
Andrew Gerrand
9cd799205e cmd/godoc: add redirect for x/term repo
Update golang/go#13104

Change-Id: I76102038d8dc87503c9a8994f9008b1a9fdb19d4
Reviewed-on: https://go-review.googlesource.com/17020
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-11-18 05:08:28 +00:00
Joe Henke
5bc19071d3 godoc/vfs/zipfs: add tests; fix handling of "/"
- add tests for Open, ReadDir, and Stat funcs
- add tests for Seek of Open()
- simplify internal handling of absolute vs. "zip" paths
- fix handling of "/"

The fix special cases this scenario, leaving the codepath for all
other file paths the same. Specifically,

- Exported funcs call stat(), so stat("/") is handled by simply
returning 0 to indicate all entries are (effectively) prefixed
by "/" and zipFI{"", nil} because "/" has no name and nil
indicates it is a directory.

- ReadDir("/") is further handled by seeding the existing lookup
logic with "" instead of what would have been "/". This is
necessary because, per the zipfs spec, the zip file entries MUST
NOT start with "/", so using "/" would incorrectly match nothing.
This works because seeding lookup with "" (correctly) matches
all files and then the following, existing logic (correctly) pares
things down to just the files in the root directory; not in any
subdirectories.

Verified that godoc -zip still works.

Fixes golang/go#12743

Change-Id: Icb5f01b8a29cefa4e2820135f318894042970301
Reviewed-on: https://go-review.googlesource.com/16925
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-17 21:45:41 +00:00
Ian Lance Taylor
d94e6fe0fd container/intsets: use fast popcount with gccgo
Use the compiler intrinsic __builtin_popcount.

Change-Id: I58286fbcf66d1068390ea9caff2f98b8fe244c2d
Reviewed-on: https://go-review.googlesource.com/16831
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-11 02:17:02 +00:00
David Symonds
3dedf801dd container/intsets: update build tags to exclude assembly from gccgo.
Change-Id: I6f3b351d42f5534dd5a5ff161f1e5680b4dbfd58
Reviewed-on: https://go-review.googlesource.com/16793
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-11 01:35:11 +00:00
Dmitri Shuralyov
747ae2594e go/buildutil: Fix example code for TagsFlag.
The example incorrectly used buildutil.TagsDoc identifier which does not
exist. It should be buildutil.TagsFlagDoc instead.

The issue was introduced in https://golang.org/cl/9172 when this code was
first written.

Also use more idiomatic style for Go comments, '//' followed by a space,
then tab (instead of skipping the space). Although both render correctly
in godoc, this form is more correct and consistent.

Change-Id: I3b3c9767fe313106a8ff81e7887f3241c5806b59
Reviewed-on: https://go-review.googlesource.com/16743
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-11-09 14:36:24 +00:00
Tamir Duberstein
4b07c5ce8a cmd/stringer: prepend "Code" to codegen warning
This allows Github to hide diffs in generated files. See:
https://github.com/github/linguist/blob/473282d/lib/linguist/generated.rb#L241

Change-Id: Ic0a9ed80ecc6130d81fd0ba10e2df48217eb14cc
Reviewed-on: https://go-review.googlesource.com/15073
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-08 08:43:00 +00:00
Andrew Gerrand
dec63b8e98 cmd/godoc: add x/time and x/sync redirects
Fixes golang/go#13133

Change-Id: I45031352d4d7c040889134310ad5721dd9dcc1ee
Reviewed-on: https://go-review.googlesource.com/16640
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-04 02:28:00 +00:00
Andrew Gerrand
823804e1ae playground/socket: only buffer messages of one kind, add tests
Change-Id: I38c2b39fb1090669f8ede7f681f7b1c800111f23
Reviewed-on: https://go-review.googlesource.com/16508
Reviewed-by: jcd . <jcd@golang.org>
2015-10-30 06:08:43 +00:00
Andrew Gerrand
14fd3daae1 playground/socket: fix race condition and goroutine leak
Fixes golang/go#11507

Change-Id: Ifa0a34df02433b3f8a5fb60c4df4eca47750646e
Reviewed-on: https://go-review.googlesource.com/16468
Reviewed-by: jcd . <jcd@golang.org>
2015-10-30 05:20:32 +00:00
Tw
23f9896d9e present: don't ignore command within text scope
when handling text line by line, the current line will be ignored if it
may be a command line, so we should stack back this line for further parse.

Fixes golang/go#11435

Change-Id: If0567c46c90d09b30e78b72f24395725b9e00ea3
Reviewed-on: https://go-review.googlesource.com/16410
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-30 00:41:15 +00:00
Alan Donovan
199b70b426 x/tools/cmd/bundle: a tool to concatenate source files, preserving reference integrity
+ Test.

For background, see "http -> http2 -> http import cycle" thread on golang-dev.

Change-Id: Idc422247e5935ef7615cd5e8b7e2c489f7f2bc31
Reviewed-on: https://go-review.googlesource.com/15850
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-29 19:10:01 +00:00
Tw
6a71ab8780 cmd/present: only include play.js in article when necessary
There is no need to add play.js in article page when
playground is disabled.

Signed-off-by: Tw <tw19881113@gmail.com>

Change-Id: If40d256c89d7bd37efff9e08bb176bd3ea2d6f88
Reviewed-on: https://go-review.googlesource.com/16415
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-29 04:57:28 +00:00