1
0
mirror of https://github.com/golang/go synced 2024-11-05 14:56:10 -07:00
Commit Graph

95 Commits

Author SHA1 Message Date
Alan Donovan
574d60b05a refactor/rename: skip TestDiff on plan9, whose diff has no -u
Change-Id: I372591ad3f2804dcd20f0ab3b5a91ddda762cba8
Reviewed-on: https://go-review.googlesource.com/33586
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-28 18:25:41 +00:00
Alan Donovan
be0bbf2399 refactor/...: remove go1.8-tagged files
Change-Id: I7df485b71ba87670d9e70e5b44e2110fd8f6a815
Reviewed-on: https://go-review.googlesource.com/32815
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:29:48 +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
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
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
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
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
Konstantin Shaposhnikov
8ea9d46069 refactor/rename: do not allow a new name to be a keyword
Fixes golang/go#16535

Change-Id: I46f9b9530e25bb286557712a7969715f8dde99b9
Reviewed-on: https://go-review.googlesource.com/25343
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-20 16:15:16 +00:00
Alan Donovan
9c3986db53 refactor/rename: fix two bugs related to MS Windows' path separator
In the package, the added import declarations used backslashes.
In the test, filenames in warning messages used backslashes.
Now both use forward slash.

Fixes golang/go#16384

Change-Id: I43116aab0b3209305f23ed9def7c4adf3259941e
Reviewed-on: https://go-review.googlesource.com/24943
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-15 14:58:04 +00:00
Brad Fitzpatrick
e047ae774b cmd/goimports, imports: make goimports great again
I felt the burn of my laptop on my legs, spinning away while processing
goimports, and felt that it was time to make goimports great again.

Over the past few years goimports fell into a slow state of disrepair
with too many feature additions and no attention to the performance
death by a thousand cuts. This was particularly terrible on OS X with
its lackluster filesystem buffering.

This CL makes goimports stronger, together with various optimizations
and more visibility into what goimports is doing.

* adds more internal documentation

* avoids scanning $GOPATH for answers when running goimports on a file
  under $GOROOT (for Go core hackers)

* don't read all $GOROOT & $GOPATH directories' Go code looking for
  their package names until much later. Require the package name of
  missing imports to be present in the last two directory path
  components.  Then only try importing them in order from best to
  worst (shortest to longest, as before), so we can stop early.

* when adding imports, add names to imports when the imported package name
  doesn't match the baes of its import path. For example:
        import foo "example.net/foo/v1"

* don't read all *.go files in a package directory once the first file
  in a directory has revealed itself to be a package we're not looking
  for. For example, if we're looking for the right "client" for "client.Foo",
  we used to consider a directory "bar/client" as a candidate and read
  all 50 of its *.go files instead of stopping after its first *.go
  file had a "package main" line.

* add some fast paths to remove allocations

* add some fast paths to remove disk I/O when looking up the base
  package name of a standard library import (of existing imports in a
  file, which are very common)

* adds a special case for import "C", to avoid some disk I/O.

* add a -verbose flag to goimports for debugging

On my Mac laptop with a huge $GOPATH, with a test file like:

	package foo
	import (
	       "fmt"
	       "net/http"
	)

	/*

	*/
	import "C"

	var _ = cloudbilling.New
	var _ = http.NewRequest
	var _ = client.New

... this took like 10 seconds before, and now 1.3 seconds. (Still
slow; disk-based caching can come later)

Updates golang/go#16367 (goimports is slow)
Updates golang/go#16384 (refactor TestRename is broken on Windows)

Change-Id: I97e85d3016afc9f2ad5501f97babad30c7989183
Reviewed-on: https://go-review.googlesource.com/24941
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-15 05:29:07 +00:00
Alan Donovan
b3887f7a17 refactor/rename: fix spurious conflict report when renaming x/foo to y/foo
There is no need to check for import conflicts when the package name
doesn't change.  Add test.

Also, when reporting a (non-spurious) import conflict, make clear that
the error is just a warning.  Add a test for same.

Change-Id: Idde0483b502cd041fd893230fec06b8533f54f3c
Reviewed-on: https://go-review.googlesource.com/24917
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-07-14 18:43:43 +00:00
Alan Donovan
51487f711d x/tools: remove remaining files tagged for Go 1.4
(accidentally omitted from https://go-review.googlesource.com/20810)

Change-Id: Ib6ee4b2e43b6f32c5c0c031910087cc39d5c5d14
Reviewed-on: https://go-review.googlesource.com/21862
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-12 18:58:24 +00:00
Alan Donovan
f07cde3d91 refactor/eg: fix build after deletion of x/tools/go/types
Change-Id: Ic8d9c37230b3359a3caa7514c89eae9595f2fb80
Reviewed-on: https://go-review.googlesource.com/21584
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-06 22:02:45 +00:00
Konstantin Shaposhnikov
b15543bacc cmd/gorename: emacs: do not auto shrink error window
Change-Id: Iffa740a15658993cd905a34333f89145952524ca
Reviewed-on: https://go-review.googlesource.com/20289
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-07 15:44:52 +00:00
Alan Donovan
ac02106e04 refactor/importgraph: document that graphs are cyclic
Change-Id: I195656b523488433945b3215558c3442cf45b2bd
Reviewed-on: https://go-review.googlesource.com/19831
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-03 22:47:59 +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
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
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
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
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
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
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
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
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
Konstantin Shaposhnikov
0227ea4101 refactor/rename: emacs: set up autoloading of go-rename function
Add an ;;;###autoload magic comment, so that the go-rename command can be used
without need to explicitly (require 'go-rename) first.

Change-Id: Ibdf9886fe98c55e1d948469aac972b568649f910
Reviewed-on: https://go-review.googlesource.com/16327
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-10-27 13:38:02 +00:00
Konstantin Shaposhnikov
f941d540e3 refactor/rename: emacs: package.el compatibility changes
Change-Id: Ia37db2bfbe02015eb38f13fc7fc58a9aec9c551c
Reviewed-on: https://go-review.googlesource.com/15527
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-10-21 13:45:11 +00:00
Alan Donovan
5b9ecb9f68 rename/refactor: fix typo in gorename usage message
Fixes issue #12981

Change-Id: I5faf8534153b13b967ce5d8da4d56bdd2bb4c501
Reviewed-on: https://go-review.googlesource.com/16053
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-10-19 14:03:10 +00:00
David R. Jenni
13be4dfe75 refactor/mvpkg: rewrite import comments.
Fixes golang/go#10508.

Change-Id: Id9b0f12e1a81b3b16e167462fd3639a6c6c1e0bb
Reviewed-on: https://go-review.googlesource.com/15267
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-10-06 18:22:23 +00:00
Alan Donovan
b9fbbb8e31 refactor/eg: refactor to break dependency on go/loader
Change-Id: I0a865a694b911437944743f60bfaa2a937d85c9a
Reviewed-on: https://go-review.googlesource.com/14133
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-01 14:26:06 +00:00
Alan Donovan
e21b7325f7 refactor/lexical: delete package
It is possible to reconstruct the lexical environment at any point
using only Object and Scope positions; see CL 9544 for an example.

Change-Id: I1268f9490c072ceb1c4d044df2e9c49678d73dfd
Reviewed-on: https://go-review.googlesource.com/14131
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-08-31 21:14:04 +00:00
Alan Donovan
25bacdead0 refactor/rename: fix build breakage (due to go/types version skew)
Change-Id: Id798ff0acdc9d4a83efe1b760ca32ede6a1aa5bb
Reviewed-on: https://go-review.googlesource.com/14132
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-08-31 21:13:35 +00:00
Alan Donovan
03e05ec5a5 refactor/rename: eliminate dependency on refactor/lexical package
so that we can delete that package.

lexicalLookup reconstructs the lexical scope from the existing tree of
types.Scope blocks, using source position information to determine
which prefix of declarations are visible.  (Inspired by Russ's
lookupAtPos in github.com/rsc/grind/grinder.)

forEachLexicalRef implements the part of the recursion from
refactor/lexical that enumerates the ast.Idents that use lexical
lookup.  (I would still like to eliminate this redundant logic by
having go/types record environments, as in CL 9493.)

Change-Id: I040ab33b508aad2dc68fd48850fe92ec072045d1
Reviewed-on: https://go-review.googlesource.com/9544
Reviewed-by: Sameer Ajmani <sameer@golang.org>
2015-08-31 20:58:11 +00:00
Robert Griesemer
958ab4f550 x/tools: disable tests not supported on Android
For golang/go#11811.

Change-Id: Icf16a2d47fcf2fe0d79dd825ccb851a3d63a660f
Reviewed-on: https://go-review.googlesource.com/13268
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-06 00:36:03 +00:00
David R. Jenni
20d85c34f3 refactor/mvpkg: rewrite external test packages.
Rename the package name of the external test package, e.g. <from>_test to <to>_test.
Rewrite the import statements of external test packages which import the renamed package.

Fixes #10507

Change-Id: Iad702189469c54776e55ed4a821610bd9977618c
Reviewed-on: https://go-review.googlesource.com/12637
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-07-30 21:17:38 +00:00
Jeff Hodges
ea5101579e tools/refactor/rename: add provide to rename.el
Fixes #11110

Change-Id: I29eaff7f730f7680afaa9ad058ac797bdab98a18
Reviewed-on: https://go-review.googlesource.com/11947
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-07-13 22:45:56 +00:00
INADA Naoki
e81d36e137 refactor/rename: fix command name in comment
Change-Id: I7a74c07b104cf1d1adb4536522ff2341d24ebd82
Reviewed-on: https://go-review.googlesource.com/12010
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-10 11:08:02 +00:00
Alan Donovan
997b3545fd go/types: change {Type,Object,Selection}String to accept a Qualifier function
The optional Qualifier function determines what prefix to attach to
package-level names, enabling clients to qualify packages in different
ways, for example, using only the package name instead of its complete
path, or using the locally appropriate name for package given a set of
(possibly renaming) imports.

Prior to this change, clients wanting this behavior had to copy
hundreds of lines of complex printing logic.

Fun fact: (*types.Package).Path and (*types.Package).Name are valid
Qualifier functions.

We provide the RelativeTo helper function to create Qualifiers so that
the old behavior remains a one-liner.

Fixes golang/go#11133

Change-Id: Ibd63f639c7b3aa1738826d6165f2d810efeb8293
Reviewed-on: https://go-review.googlesource.com/11692
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-30 19:00:00 +00:00
Alan Donovan
a9866431ad refactor/importgraph: don't ignore imports in packages with errors.
And in gomvpkg, don't stop just because some packages had errors.
This is inevitable in a large GOPATH tree.

Fixes issue golang/go#10907

Change-Id: I9a60b070228d06d44880202eeef54394e914f5d5
Reviewed-on: https://go-review.googlesource.com/10715
Reviewed-by: Sameer Ajmani <sameer@golang.org>
2015-06-26 20:29:59 +00:00
Robert Griesemer
3f8eecd15b go/types: move MethodSetCache into package go/types/typeutil
Change-Id: Iba5d7c2df533948a5b28373b077cc0476a6745ad
Reviewed-on: https://go-review.googlesource.com/10770
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-05 17:34:01 +00:00
Dominik Honnef
9c7ccd869c refactor/rename: emacs: kill go-rename buffer correctly
Match gofmt's behaviour of closing the status buffer. Don't display the
buffer in case of success as we were going to hide it instantly again,
anyway. Also, instead of using delete-window, use
gofmt--kill-error-buffer. gofmt--kill-error-buffer uses quit-window if
there's a window for the buffer, kill-buffer otherwise.

quit-window only deletes the window if it was created explicitly for the
status buffer and if it is still displaying it. This way, we won't close
windows that the user created or repurposed himself.

Additionally, this change ensures that we don't leave a *go-rename*
buffer lying around when gorename succeeded.

Fixes golang/go#10972.

Change-Id: Id1efb60d399f0062d870e925138aa827e12f3e58
Reviewed-on: https://go-review.googlesource.com/10453
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-05-29 16:50:48 +00:00
Alan Donovan
9333b8f458 refactor/eg: fix crash while unifying wildcard with KeyValueExpr, which has no type
+ tests.

Fixes issue golang/go#10923

Change-Id: I0813cdfbb447bbd9f579bb1998b355a3179a7e79
Reviewed-on: https://go-review.googlesource.com/10332
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-05-29 16:42:57 +00:00
Alan Donovan
e591801c2d refactor/rename: fix misplaced 'continue'.
This was not a visible bug since the only caller discards the relevant
result, so I also deleted the result.

Fixes #9999

Change-Id: I276d6523b2891d3cb9c8137448e1aed32a5fd197
Reviewed-on: https://go-review.googlesource.com/5921
Reviewed-by: Michael Matloob <michaelmatloob@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-17 20:38:58 +00:00
Alan Donovan
2206711864 refactor/rename: don't make backups; overwrite in place, preserving inode.
This avoids littering the tree, and confusing some editors (e.g. Atom)
that expect the inode number to remain constant.

Change-Id: I2faeda1ed1b01e5e4cc720744ea3c99ab29e7333
Reviewed-on: https://go-review.googlesource.com/7664
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-17 16:03:22 +00:00
Alan Donovan
bdcea2c1b3 go/buildutil: use chan (not func) in the ForEachPackage API
The callbacks are intentionally concurrent, making this function very
easy to misuse (most clients so far have got it wrong, even my own).
Using a channel in the API makes the concurrency obvious, the
correct usage easy, and the client control flow simpler.

Change-Id: Ied38c3ed5c98b40eb1b322a984ed9dc092ac0918
Reviewed-on: https://go-review.googlesource.com/3250
Reviewed-by: Sameer Ajmani <sameer@golang.org>
2015-03-05 20:14:20 +00:00
Alan Donovan
4744be3abc refactor/eg: use format.Node not printer.Fprint for canonical output
Fixes golang/go#10038

Change-Id: If3243f0c68fc0442dcc1e2dd71cbdc629beff70c
Reviewed-on: https://go-review.googlesource.com/6481
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2015-03-02 19:38:58 +00:00
Alan Donovan
69db398fe0 go/loader: rename SourceImports flag to ImportFromBinary and invert sense
...since the zero value is more useful by far.

This is a breaking API change, obviously.  (One or two tests in this
CL have intentional been left using the zero value, i.e., they now
load source.)

Change-Id: I42287bfcdb1afef8ee84e5eac12534dd0a1fd5d2
Reviewed-on: https://go-review.googlesource.com/5653
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-23 23:01:10 +00:00