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

2137 Commits

Author SHA1 Message Date
Alan Donovan
9a286cdc33 cmd/stringer: reject Go 1.8 type aliases
Change-Id: I56e615bf202ca2018602c93e66ecdbc2577335e2
Reviewed-on: https://go-review.googlesource.com/32731
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-03 21:54:35 +00:00
Alan Donovan
4d145add37 cmd/ssadump: fix typo that broke -run
Change-Id: I6cc618a3cf1036f4dffb2acad766d86c14d658cd
Reviewed-on: https://go-review.googlesource.com/32645
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 16:19:08 +00:00
Robert Griesemer
f08d70c2ed go/gcimporter15: support export/import of invalid aliases
+ test

Tested on 1.6, 1.7, and 1.8.

Fixes golang/go#17731.

Change-Id: I06dff4a72ff08ed5e8ae1d23a1e65fe719c03180
Reviewed-on: https://go-review.googlesource.com/32581
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-03 15:57:31 +00:00
Robert Griesemer
c3ce94f8a8 go/gcimporter15: update importer test (fix build)
The -newexport flag is on by default for 1.7,
no need to special-case it anymore.

Tested against 1.6, 1.7, and 1.8.

Change-Id: I9c4a31f80d1309564e2a01514fca4b17e4378b9c
Reviewed-on: https://go-review.googlesource.com/32582
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-02 23:36:01 +00:00
Robert Griesemer
d54c98191e go/loader: fix ExampleConfig_Import (fix build)
TBR=adonovan

Tested against 1.6, 1.7, and 1.8.

Change-Id: Ifd8e02a83e7b92c00a746f10475ab725801199e2
Reviewed-on: https://go-review.googlesource.com/32638
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-02 23:31:09 +00:00
Matthew Dempsky
d4397e8931 go/gcimporter15: backport double-export fix for aliased objects
Backport of https://golang.org/cl/32575.

Change-Id: Ic4b0794ee440b7ac6275f0ef7dacda20de4fdad0
Reviewed-on: https://go-review.googlesource.com/32577
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-02 20:38:00 +00:00
Robert Griesemer
a829b5068d go/gcimporter15: remove support for Go1.5
Change-Id: I183090131a675237be42cc005719554399704f8d
Reviewed-on: https://go-review.googlesource.com/32541
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-02 18:31:16 +00:00
Robert Griesemer
a4fe4f6140 go/gcimporter15: implement support for exporting aliases
Tested with 1.6, 1.7, 1.8.

Change-Id: Ib0f751484c360b02aa34c993ce795cb94656705f
Reviewed-on: https://go-review.googlesource.com/32540
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-02 18:30:30 +00:00
Robert Griesemer
5b3db00587 go/gcimporter15: implement support for importing aliases
- backport of changes made to std lib:
  https://go-review.googlesource.com/32350/
  https://go-review.googlesource.com/32538

- factored out newAlias for non-Go1.8 builds

- tested against 1.6, 1.7, 1.8

Change-Id: I538b2d4a0f0c93c517a7aaa3b1562aa3afd154dd
Reviewed-on: https://go-review.googlesource.com/32470
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-02 17:35:51 +00:00
Alan Donovan
4549178751 x/tools: clone some files in preparation for alias changes
This CL only copies files and updates build tags.
Substantive changes will come in follow-ups.
This is a workaround for git's lack of rename/copy tracking.

Tested with go1.6, go1.7, and tip (go1.8).

Change-Id: Id88a05273fb963586b228d5e5dfacab32133a960
Reviewed-on: https://go-review.googlesource.com/32630
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-02 16:57:37 +00:00
Alan Donovan
1529f889eb cmd/guru: report start and end positions for non-PkgName Objects
Most objects are declared by an identifier, so the end position is
start+len(name).  However, this heuristic doesn't work for PkgName
objects because a (non-renaming) import creates an object without an
identifier.

Fixes issue github.com/Microsoft/vscode-go#562

Change-Id: I0eb44ca33a643c910d97abbf700ea4c3cd23bb41
Reviewed-on: https://go-review.googlesource.com/32440
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-31 16:37:29 +00:00
Alan Donovan
b814a3b030 go/internal/gccgoimporter: use 0 not io.SeekStart for Go 1.6 compatibility.
Change-Id: I396e221217c7fac5e7a9d66cbd97ef51782b0dd8
Reviewed-on: https://go-review.googlesource.com/32298
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-28 18:18:45 +00:00
Alan Donovan
f24fea3cd4 go/gcexportdata: suppress example_test.go on Go 1.6
because its export data doesn't contain file position information.

Change-Id: Ia3ab54ae8a493666b9ad63577aa8fad513385052
Reviewed-on: https://go-review.googlesource.com/32299
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-28 18:18:30 +00:00
Alan Donovan
6d7cee0134 go/gcimporter15: read v3 export data not containing type aliases
This is a short-term stop-gap to keep the builders happy.

Change-Id: I87171c20bf44f36fd2c4d7213211217de6110fdd
Reviewed-on: https://go-review.googlesource.com/32293
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-28 16:05:56 +00:00
Alan Donovan
0db92ca630 go/gcexportdata: make example portable to MS Windows, 2nd attempt
(The first was go-review.googlesource.com/c/31813)

Fixes issue golang/go#17565

Change-Id: I61c124e041af689913aedebdde654197c5526228
Reviewed-on: https://go-review.googlesource.com/32034
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-25 20:54:37 +00:00
Alan Donovan
17d0fe57ec go/gccgoexportdata: lost edits from review of CL 31822
Change-Id: I4d1eb36c2da5c7ad51989a1c9ab09b03019fd8f0
Reviewed-on: https://go-review.googlesource.com/31971
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-25 15:10:52 +00:00
Alan Donovan
5e7fa1cbaa go/gccgoexporter: an API for parsing gccgo export data
This package is provided as a stop-gap until gccgo uses the same export
data format as gc.  Once that occurs, this package will be deprecated
and eventually deleted.  The API is similar to (a subset of) gcexportdata.

Change-Id: I3398dbb8eab508a24d12036bbadaa60c2c1e77b3
Reviewed-on: https://go-review.googlesource.com/31822
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-25 15:07:10 +00:00
Alan Donovan
20055e012d go/internal/gccgoimporter: fork go/internal/gccgoimporter
The standard go/internal/gccgoimporter package is essentially unusable
behind the go/importer.For API, so this change makes a copy of it in
x/tools.  A follow-up change will expose a small but usable API to it.

Change-Id: Ica5092267ecafb78e1d983c86aa46e4e0bef02d5
Reviewed-on: https://go-review.googlesource.com/31854
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-24 21:32:26 +00:00
Alan Donovan
b5ed9db83f go/gcexportdata: support old export data (again), needed by AE1.6
+ test

Change-Id: I0842795ece634e4441b17a10009d26bfc2a8481a
Reviewed-on: https://go-review.googlesource.com/31818
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-24 17:37:43 +00:00
Alan Donovan
0f7f54c9d9 go/gcexportdata: make test portable to MS Windows
Fixes issue #17565

Change-Id: I67d2e11acae873ac47694a73ced40d2db38c0fc0
Reviewed-on: https://go-review.googlesource.com/31813
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-24 16:32:43 +00:00
Alex Carol
c6efba04dd present: add speaker notes to the title page
Change-Id: I68f17f933e2526c6419e1463acfcb3c838aeecf4
Reviewed-on: https://go-review.googlesource.com/31396
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
2016-10-19 22:19:41 +00:00
Alan Donovan
1a954d519b go/gcexportdata: a new simpler API for the deprecated go/gcimporter15
Fixes golang/go#15651

Change-Id: I7dc7ba731a22c677e3c01bf13e91ecfff9e46765
Reviewed-on: https://go-review.googlesource.com/30612
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-19 20:22:14 +00:00
Alan Donovan
8b5a8a45ae refactor/rename: remove Emacs support, now in github.com/dominikh/go-mode.el
Change-Id: I710e0ae0dcecebbd3f02a8a2186e461f9435d731
Reviewed-on: https://go-review.googlesource.com/31412
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-19 19:59:35 +00:00
Alan Donovan
8e53eb937b go/ssa: support custom TestMain functions in test packages
Supporting user-defined TestMain functions requires that we generate a
"testmain" package for each testable package, rather than a single one
for the entire program.  This entails these API changes:

1. (*ssa.Program).{CreateTestMainPackage,FindTests} both now
   accept only a single package.  Existing clients that pass them
   multiple packages must call them from a loop.

2. (*ssa.Program).FindTests returns an additional result, the the
   optional TestMain *ssa.Function.  Existing clients may discard it.

Also:
- Test the new logic using the SSA interpreter
- add ssautil.MainPackages helper
- callgraph: allow multiple main packages, and analyze them all
- ssadump -run: allow multiple main/test packages, and run each in a new interpreter
- minor simplifications to some callers (e.g. guru)

Fixes golang/go#9553

Change-Id: Ia7de9bd27448fb08b8d172ba5cdbcf37a762b7a0
Reviewed-on: https://go-review.googlesource.com/25102
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-19 17:50:59 +00:00
Dominik Honnef
860883f6da refactor/rename: require cl-lib, use cl- namespace
go-rename.el used the cl list* macro without requiring cl. This only
worked for people who required it for other code. go-guru.el, before its
removal from the tree, changed from cl to cl-lib, indirectly breaking
go-rename.el for some users.

Switch to using cl-list* and require cl-lib.

Fixes golang/go#17468

Change-Id: I70f2052b9fd3d1a8671794d9a3954be218026af2
Reviewed-on: https://go-review.googlesource.com/31471
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-19 16:26:16 +00:00
Rhys Hiltner
af95c112ad go/ast/astutil: do not remove imports in AddNamedImport
When adding imports to an existing import declaration, ensure that
the target declaration will be printed with parentheses. This allows
all of the imported packages to be printed, not just the first one.

Fixes golang/go#17212

Change-Id: Ie5de5ec9bca6169650336ee2ea98334817e64e48
Reviewed-on: https://go-review.googlesource.com/29688
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-18 18:48:44 +00:00
Alan Donovan
69f6f5b782 cmd/guru: remove Emacs support, now at github.com/dominikh/go-mode.el
Change-Id: I4350331b4f047b7388c274157ecbd49a582cf091
Reviewed-on: https://go-review.googlesource.com/30991
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:55:30 +00:00
Alan Donovan
ab8f7d902d cmd/guru: remove Vim support, now at github.com/fatih/vim-go
Change-Id: I94f478e32f358fd23dc187fcfbca9c05bf7da576
Reviewed-on: https://go-review.googlesource.com/30990
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:54:40 +00:00
Alan Donovan
2f93937767 x/tools: s/oracle/guru/g in various comments
Change-Id: Ie0da80db4f58d9f6e7d9675c89f106d1cd01710a
Reviewed-on: https://go-review.googlesource.com/30983
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:54:04 +00:00
Alan Donovan
d9f9484612 cmd/oracle: oracle is dead, long live guru
Change-Id: I0f729b1477d8b14f255538414087d25f99b20c1e
Reviewed-on: https://go-review.googlesource.com/30982
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:53:55 +00:00
Russ Cox
b44548ae6a go/vcs: accept plain file for .vcs (instead of directory)
Sometimes .git is a plain file; maybe others will follow.

Fixes golang/go#10322.

Change-Id: Id57424998c207080c3ed5826b1e5e091fa26aad5
Reviewed-on: https://go-review.googlesource.com/21430
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-13 13:57:49 +00:00
Brad Fitzpatrick
a2b1312ca0 cmd/godoc: increase test timeout
Darwin was flaking. Its HFS filesystem is probably too slow.

Change-Id: I44ea6de8dae8054d41c94c0c36e703e62fbdfcd9
Reviewed-on: https://go-review.googlesource.com/30954
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-12 16:04:38 +00:00
Alan Donovan
992f6f9bcc go/loader: fix CreateFromFilenames example
The "sort" package is no longer quite as low-level as it once was.

Change-Id: Ic62d780841ef1172f65d4c00ec500994f94cb4b7
Reviewed-on: https://go-review.googlesource.com/30931
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-12 15:34:52 +00:00
Brad Fitzpatrick
41f4ee4e59 cmd/godoc, cmd/fiximports: fix or skip failing tests at tip
Fix godoc test failure.

Skip fiximports test failure for now, to not hide other
failures. (tracking bug to fix properly in golang/go#17417)

x/tools being broken is preventing use of trybots for unrelated CLs.

Change-Id: I3a1deee4036096e0377cf8b63fabe444c58dd86e
Reviewed-on: https://go-review.googlesource.com/30953
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-12 15:24:30 +00:00
David R. Jenni
f4e1751b91 go/ast/astutil: handle documentation of imports in DeleteNamedImport.
If the parens of an ast.GenDecl are dropped, move the documentation
of the ImportSpec above the import statement, otherwise the the
code is invalid.

Fixes golang/go#15432.

Change-Id: I715750b8f528380b96a6bc8b5f216043937976c2
Reviewed-on: https://go-review.googlesource.com/22415
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-12 15:09:30 +00:00
Syohei YOSHIDA
5e567c6dff cmd/guru: emacs: Use cl-lib.el instead of cl.el
This package requires cl-lib.el in package header but it is not loaded
and cl.el functions are used instead of cl-lib functions. Using cl.el
functions causes byte-compile warnings.

Change-Id: I6d9400f9ced6a5cc0592d83da2ab1c1cf34e20b8
Reviewed-on: https://go-review.googlesource.com/27031
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-12 14:21:26 +00:00
Francesc Campoy
8453f27cc7 present: make code in slides editable only with -edit
Also added a suite of tests and fixed a minor bug that
caused a panic when the .code command specified HL with
no text after.

Fixes golang/go#17379.

Change-Id: I3c246523c3d4010bf76a467ee648475255090e1b
Reviewed-on: https://go-review.googlesource.com/30691
Reviewed-by: Rob Pike <r@golang.org>
2016-10-07 20:29:58 +00:00
Tamir Duberstein
4c4edc0bec cmd/goyacc: remove hardcoded NTYPES
Updates #16144.

Change-Id: I196dd4e871c88792ea95c02b31c54f269fdc505f
Reviewed-on: https://go-review.googlesource.com/27350
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-07 17:45:45 +00:00
Robert Griesemer
b5358b5fee go/gcimporter15: update exportdata.go to match latest version from std lib
For golang/go#17281.

Change-Id: I7bed233368939719672eb331cca1d6aef01e807d
Reviewed-on: https://go-review.googlesource.com/30591
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-06 19:19:18 +00:00
Alan Donovan
03663480fa go/buildutil: ExpandPatterns: ignore a trailing slash in a pattern
Previously, a trailing slash would cause "foo/" to be treated as the
name of a package, with comical results.

Fixed golang/go#14584

Change-Id: I660f8a079bbd63d3645812e516a9264c8e080e61
Reviewed-on: https://go-review.googlesource.com/30452
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-05 19:34:25 +00:00
Alan Donovan
27f88d9b7a cmd/guru: if query file is not beneath GOPATH, treat it as a package
This allows type-based guru queries to work on arbitrary files at the
root or even outside of a GOPATH workspace (as "go run foo.go" does).

Fixes golang/go#15797

Change-Id: I2be28f7259448e6398aae84d6ae7e71d8649967a
Reviewed-on: https://go-review.googlesource.com/30451
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-05 18:29:27 +00:00
Mohit Agarwal
73d2e795b8 cmd/godoc: fix command for creating the zip file
The `-r` option (to recurse into directories) need to be specified
else the created file consists only of the specified directory and
nothing else.

Change-Id: I624184fc2e88998a3119c12f8c328603588c123c
Reviewed-on: https://go-review.googlesource.com/17283
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-04 20:51:58 +00:00
Francesc Campoy
471a6e15ec godoc: drop outdated comment
Change-Id: I2a4d0c112575cad70180ba0f8984a271a7658775
Reviewed-on: https://go-review.googlesource.com/29686
Reviewed-by: Sameer Ajmani <sameer@golang.org>
2016-10-04 17:46:36 +00:00
Alan Donovan
fc2b74b64e refactor/rename: don't stop because of "soft" errors
Because go/types is slightly more strict than gc about certain "soft"
errors (ones that aren't necessary to interpret a Go program), gorename
rejects programs that compile under gc.  This change relaxes gorename's
error checks so that they are weaker than gc's.

This is a workaround for issue golang/go#14596 in gorename,
whose underlying problem is issue golang/go#8560 in gc.

Fixes golang/go#14596

Change-Id: Ica5006c2376c0564a575224269093c1497348ee6
Reviewed-on: https://go-review.googlesource.com/29853
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-27 16:36:09 +00:00
Rhys Hiltner
c2ef61f450 go/ast/astutil: fix loop logic in AddNamedImport
When merging import declarations into a single block, AddNamedImport
modifies the list of declarations in the provided file while
iterating over the list. Take care to adjust the index into the list
so as to not skip entries or fall off the end.

Fixes golang/go#17213

Change-Id: I807246f762c965ea1fc51eb57759f6088336db86
Reviewed-on: https://go-review.googlesource.com/29681
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-24 00:48:36 +00:00
Francesc Campoy
3f4088edb4 godoc: avoid exposing absolute paths on 404
Exposing the full paths to files is considered possible
source of vulnerabilities.

Change-Id: Ie9ae3791e51fcff5f1df711f84db9879d7e6ce37
Reviewed-on: https://go-review.googlesource.com/29445
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-21 00:04:58 +00:00
Brad Fitzpatrick
f1a397bba5 cmd/bundle: add flag to rewrite golang.org/ to golang_org/ in imports
I've been doing this by hand since Go 1.7rc2.

Updates golang/go#16333

Change-Id: Ib12c013b14210123d48d6ad78922caf1286c20cc
Reviewed-on: https://go-review.googlesource.com/29086
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-09-13 16:37:30 +00:00
Dominik Honnef
5ffc3249d3 present: dont crash if address searched backwards
For /start/,/end/, the /end/ address can wrap around and match somewhere
before /start/. Handle this case without crashing.

Fixes golang/go#7163.

Change-Id: I6fc3b5048e88728c9403a1d1e284ea8ada567a1e
Reviewed-on: https://go-review.googlesource.com/21182
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-09-13 12:21:10 +00:00
Alan Donovan
86ad1193da go/ssa/interp: turn {strings,bytes}.init into no-ops
...to avoid executing the supportAVX2 assembly function.

Also, combine all no-op intrinsics into a single function.

Change-Id: Ic65a80d3a6df52c3850c34406f034781057a0991
Reviewed-on: https://go-review.googlesource.com/28711
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-09-07 20:36:55 +00:00
Robert Griesemer
9deed8c6c1 go/gcimporter15: update to recognize export format version 2
Port of https://go-review.googlesource.com/#/c/27999/.

Change-Id: I71c4553e925fcf943ecafdef307591f63136d432
Reviewed-on: https://go-review.googlesource.com/28001
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-29 18:38:39 +00:00