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

1722 Commits

Author SHA1 Message Date
Alan Donovan
35b3d645bc oracle: fix panic when describing "unsafe"
Fixes issue 14160

Change-Id: Ie27d79ba135cadd2e6f5d3b40b8eca25b6a030d9
Reviewed-on: https://go-review.googlesource.com/19158
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-03 15:29:59 +00:00
Brad Fitzpatrick
b47dfd93e5 all: fix plan9 failures
Updates golang/go#11811

Change-Id: I6ed252eb3272354fce8084ec99f4777e41c3daa3
Reviewed-on: https://go-review.googlesource.com/18993
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-28 00:31:03 +00:00
Brad Fitzpatrick
2fd075ed02 all: skip slow tests in short mode
Updates golang/go#14113
Updates golang/go#11811

Change-Id: I61851de12ff474d3b738fc88f402742677973cae
Reviewed-on: https://go-review.googlesource.com/18992
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-28 00:14:01 +00:00
Mikio Hara
09dc3ef4c7 go/gcimporter15: fix build
This change prevents test code to slip into package gcimporter15 and
fixes a weird situation that the test passes but the package doesn't
exist.

For example, we can see the situation with Go 1.6 like the follwoing:

go build
./gcimporter_test16.go:20: undefined: MustHaveGoBuild
./gcimporter_test16.go:45: undefined: testPath

go test
PASS
ok  	golang.org/x/tools/go/gcimporter15	0.896s

Change-Id: I95550574ccd1b2273072c700c28a82c791c16c63
Reviewed-on: https://go-review.googlesource.com/18950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-27 07:08:15 +00:00
Andrew Gerrand
95cc01bac9 godoc/static: fix dd styles
This makes /doc/install/source render correctly.

Fixes golang/go#14104

Change-Id: I58a883abd875197064a5e120a47e5ea8faad7df9
Reviewed-on: https://go-review.googlesource.com/18955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-27 04:50:12 +00:00
Chris Broadfoot
e7cdd7bb9f cmd/tip: update deploy instructions
Change-Id: I5c26a2fc8ef7c0ad99c3d176b866f221cb39c9e2
Reviewed-on: https://go-review.googlesource.com/18980
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-27 02:50:12 +00:00
Mikio Hara
7421583666 go/vcs: drop support for Google Code Project Hosting
The hosting service was shut down on January 25, 2016 and a few tests
started to fail like the following:

=== RUN   TestRepoRootForImportPath
--- FAIL: TestRepoRootForImportPath (2.47s)
	vcs_test.go:129: RepoRootForImport("code.google.com/p/go"):
unable to detect version control system for code.google.com/ path
FAIL

This change drops support for code.google.com and fixes test. See
http://google-opensource.blogspot.jp/2015/03/farewell-to-google-code.html
for further information.

Fixes golang/go#14105

Change-Id: I87cb9a3d666c2a1af0f8bf39a66ba0f669c99fd5
Reviewed-on: https://go-review.googlesource.com/18951
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-27 00:23:28 +00:00
Chris Broadfoot
ce967854d3 cmd/tip: move side health check to main health check. Use 503.
500 is considered to be healthy. Use 503 instead, so the instance is
considered unhealthy while the side is coming up.

Add some extra log statements that help debug instances from
application logs.

Fixes golang/go#13682.

Change-Id: I713c8c2fa75de4e275f632b999edc98cedd257bd
Reviewed-on: https://go-review.googlesource.com/18547
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-25 21:17:16 +00:00
Alan Donovan
f3a63969dd go/gcimporter15: fix build for go1.4
Change-Id: I0b2650bbb2bf35d7895e1a808cfb45f7f0194ea9
Reviewed-on: https://go-review.googlesource.com/18822
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-21 22:50:50 +00:00
Robert Griesemer
d2e00652ba x/tools: fix build
Change-Id: I02b42abcc29ee04c8f54dc8ba2c6079b3e6c4153
Reviewed-on: https://go-review.googlesource.com/18816
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-21 22:29:25 +00:00
Scott Mansfield
abfa4875c0 cmd/gorename: Fixing panic when showing diffs
When displaying a diff the gorename command would panic because the
stdout variable was never set. These changes default stdout to
os.Stdout.

Fixes https://github.com/golang/go/issues/14009

Change-Id: I0902b2b4e2b8e1f46f8ab50e30dcfc841c925174
Reviewed-on: https://go-review.googlesource.com/18813
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-21 20:39:40 +00:00
Robert Griesemer
7912bef4df go/gcimporter15: only test binary export when running against Go 1.6
Also: rename setname15.go to setname.go for consistency

Change-Id: I3f7e37ef4ade716ce64674edb4d53a543a1150c5
Reviewed-on: https://go-review.googlesource.com/18772
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-20 21:48:19 +00:00
Robert Griesemer
e6d5370703 go/gcimporter15: implement types.Package.SetName for Go 1.5
This makes gcimporter15 build against Go 1.5.

Change-Id: I14e7ff80b28d99f996abc19a0a74b08e5e1bbd75
Reviewed-on: https://go-review.googlesource.com/18771
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-20 21:18:18 +00:00
Robert Griesemer
2fb4b8bc95 go/gcimporter15: use latest std/lib gcimporter code
Change-Id: Ia497e56084cf262510461b7e94296570ca8e2049
Reviewed-on: https://go-review.googlesource.com/18770
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-20 20:18:03 +00:00
Dmitri Shuralyov
5804fef4c0 x/tools/go/vcs: fix FromDir returning bad root on Windows
Import path is a '/'-separated path. FromDir documentation says
on return, root is the import path corresponding to the root of
the repository. On Windows and other OSes where os.PathSeparator
is not '/', that wasn't true since root would contain characters
other than '/', and therefore it wasn't a valid import path
corresponding to the root of the repository. Fix that by using
filepath.ToSlash.

Add test coverage for root value returned from FromDir, it was
previously not tested.

Additionally, remove a dubious statement from the documentation
"(thus root is a prefix of importPath)". There is no variable
importPath that is being referred to. It's also redundant and
confusing. Without it, the description of root value matches
the documentation of RepoRoot.Root struct field:

	// Root is the import path corresponding to the root of the
	// repository.
	Root string

Fixes golang/go#7723.

Change-Id: If9f5f55b5751e01a7f88b79d9b039402af3e9312
Reviewed-on: https://go-review.googlesource.com/18461
Reviewed-by: Chris Manghane <cmang@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-19 15:45:24 +00:00
Kenji Kaneda
3c782264fb go/types: fix a comment of Named.Obj
// TypeName returns ...
-> // Obj returns ...

Change-Id: I2ac6133a703ec2c4b2045d4bdf9acc70049f0e1e
Reviewed-on: https://go-review.googlesource.com/18704
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-16 17:31:34 +00:00
Daniel Morsing
ae18226edd oracle: handle implicit selections in callees
The types only optimization for callees looked at the type of the
receiver to figure out if it was a dynamic call. If the selection
involves any implicit selections, we cannot be sure that this type
is the one that will actually receive the call.

Fix by working backwards from function signature to find the true
receiver

Change-Id: If79e3de7af33480e37bcf1081abe44bb04914da4
Reviewed-on: https://go-review.googlesource.com/18563
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-13 18:20:05 +00:00
Alan Donovan
5a2875abe7 go/loader: reduce contention for findPackage mutex
...by making the cache non-blocking and duplicate-suppressing.

(The bottleneck was introduced while adding vendoring support.)
This reduces the 95th percentile map shard time for type-checking 120K
packages to 8min from 20min.

Also: move the I/O-limiting counting semaphore and the NoGoError check
from FindPackage to findPackage so that all implementations benefit.

Change-Id: I43527122262cf80475dd3212d78c340e1c71e36c
Reviewed-on: https://go-review.googlesource.com/18580
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-13 18:09:25 +00:00
Andrew Gerrand
b81ea3a5e1 godoc: hide vendored packages from /pkg/ as we do with internal packages
Such packages may be viewed by adding ?m=all to the URL.

Fixes golang/go#13929

Change-Id: Id0ac48bc2937b5bec722b95b9a690d48d065ea6b
Reviewed-on: https://go-review.googlesource.com/18554
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-13 08:57:48 +00:00
Timothy Studd
b57d82def5 x/tools/present: add video element for slides
Change-Id: I19f7c181d9bd8148f7791925f04207a34c95ac1e
Reviewed-on: https://go-review.googlesource.com/18484
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-13 03:34:37 +00:00
Alan Donovan
f8ecfdb6b6 cmd/stringer: fork and tag for go1.4
The previous change updated the import of golang.org/x/tools/go/types
to the standard go/types package, causing 1.4 builds to fail.

Fixes #13874.

Change-Id: Idf0b4ac5e4e01dd5cd7cc9b89d017fbffb7a29df
Reviewed-on: https://go-review.googlesource.com/18430
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-11 14:24:22 +00:00
Timothy Studd
4ad533583d x/tools/godoc: fixed width limit for non-paragraph text
Change-Id: I6020e03959a434622e3e999e0054849f0bfb522f
Fixes: golang/go#13602
Reviewed-on: https://go-review.googlesource.com/18361
Reviewed-by: Francesc Campoy Flores <campoy@golang.org>
2016-01-09 02:08:43 +00:00
Alan Donovan
ae186f56a2 go/loader: don't treat unsafe specially wrt vendoring
The loader treats GOROOT's "unsafe" package specially,
with no source files and a Package of types.Unsafe.

Tested on Go 1.4.1, 1.5, and ~1.6 (tip).

Fixes issue #13882

Change-Id: I86c4e394665d86a50ec3852d6d702f0e9c5d2276
Reviewed-on: https://go-review.googlesource.com/18457
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-08 20:29:04 +00:00
Alan Donovan
e211dfb000 refactor/rename: fix crash with "." as -from package
Cause: the absolute cwd, not ".", must be passed to build.Import.

Also: simplify the lookup logic in findFromObjects, and handle nil
gracefully.

(No unit test---not worth faking os.Getwd.)

Fixes issue #13866

Change-Id: I7e8eede55bc83d98e2ef5e42609c287e74c04501
Reviewed-on: https://go-review.googlesource.com/18453
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-01-08 19:32:44 +00:00
Alan Donovan
1fb1f857ac go/loader: use Skipf in test
(late response to comment in review of CL 18452)

Change-Id: I1fa80fd1c7fd22cec752c839d20a483e0732337c
Reviewed-on: https://go-review.googlesource.com/18454
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-01-08 19:32:38 +00:00
Alan Donovan
10712091e1 tools: fallout from flipped sense of build.IgnoreVendor flag
(See https://go-review.googlesource.com/#/c/18450)

Details:
- delete buildutil.AllowVendor flag.
  Instead use unexported 'go16' var in each package that needs it.
- delete buildutil.StripVendor; was never needed.
- remove inapplicable vendoring comments from loader14.go
- importgraph: go1.5: don't bother checking for 1.6 before calling
  absolutize (minor simplifiication and deoptimization).

Tested on 1.4.1, 1.5, and ~1.6 (tip).

Change-Id: If692b0df2eb6c120a9c09d7b1ed99f1b4c6b0826
Reviewed-on: https://go-review.googlesource.com/18452
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-08 18:54:48 +00:00
Robert Griesemer
dd6e749ee1 refactor/rename: skip Diff test on Windows (build fix attempt)
TBR=adonovan

Change-Id: I37dd29bfaa73b4b563c19be5fa47b938f06a4e0d
Reviewed-on: https://go-review.googlesource.com/18392
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-08 00:30:52 +00:00
Alan Donovan
da91609d88 cmd/vet: roll back update of go/types import
(from importing golang.org/x/tools/go/types to std lib go/types)

The cmd/vet package should never have been included in this change.

Tested with 1.4.1, 1.5 and ~1.6 (tip).

Change-Id: I6d915619cbfa0297dbb9aa9ba033c1320a08c367
Reviewed-on: https://go-review.googlesource.com/18385
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-07 20:27:05 +00:00
Alan Donovan
4747062949 go/gcimporter15: a copy of go/gcimporter using go1.5 std go/types
Because the std go/importer's Lookup functionality is incomplete,
clients have no way to create a Go 1.5 types.Package from an io.Reader
reading from gc export data.  This package provides a stopgap until
the standard library is complete.

The go/gcimporter package remains unchanged, and uses only the
golang.org/x/tools/go/types package.

Change-Id: I47a817f4b6a52ddab26c6b01de6e28099301faf5
Reviewed-on: https://go-review.googlesource.com/18382
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-07 18:06:54 +00:00
Andrew Gerrand
819a9109e1 godoc/dl: record and display SHA256 hashes for files
Fixes golang/go#12057

Change-Id: I2e0a27c96f3f13478a079765b8c363c9f3919c48
Reviewed-on: https://go-review.googlesource.com/18354
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-07 05:23:22 +00:00
Timothy Studd
1e63c6ac3b present: add background image element for slides
Fixes golang/go#11470

Change-Id: I665622197bea48b95adc839be8de7d03bf812f37
Reviewed-on: https://go-review.googlesource.com/18360
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-07 03:28:50 +00:00
Andrew Gerrand
791f468ced godoc/static: show relevant test instructions on install page
Fixes golang/go#12490

Change-Id: Ifb408f225a84b3c5daf739e1e0afc4f5540e4ebd
Reviewed-on: https://go-review.googlesource.com/18278
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-07 01:41:21 +00:00
Alan Donovan
542ffc7e75 tools: switch to standard go/types at tip
A few files have been forked and tagged "go1.5,!go1.6" to work around
minor API changes between the two types packages:
- constant.Value.String() in oracle/describe.go and its tests;
- constant.ToInt must now be called before constant.Int64Val.
- types.Config{Importer: importer.Default()} in a number of places
- go/types/typeutil/import_test.go uses lowercase names to avoid 'import "C"'.

Files in go/types/typesutil, missing from my previous CL, have been
tagged !go1.5; these files will be deleted in February.

All affected packages were tested using 1.4.1, 1.5, and ~1.6 (tip).

Change-Id: Iec7fd370e1434508149b378438fb37f65b8d2ba8
Reviewed-on: https://go-review.googlesource.com/18207
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 22:15:26 +00:00
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