1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:08:36 -06:00
Commit Graph

69 Commits

Author SHA1 Message Date
Michael Fraenkel
af2bfe26b6 cmd/gomvpkg: Only process paths that are children
When determining children of a parent directory, look for the expected /
to avoid processing directories that look similar but are not direct
descendants.

Fixes golang/go#21991

Change-Id: I5c7d18076540e5588a856845f04645231856196f
Reviewed-on: https://go-review.googlesource.com/65672
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-01-17 19:58:32 +00:00
David R. Jenni
c84da9fa1c refactor/rename: fix test failures in TestRewrites.
CL https://golang.org/cl/66130 changes go/printer to format one-method
interfaces to be printed on a single line. This change broke the
equality check in TestRewrites. Fix it by reformatting the expected
file buffers so that the tests pass with tip and previous Go versions.

Change-Id: I660efd81b362554db0515760dad7c8b62e4db1b3
Reviewed-on: https://go-review.googlesource.com/75812
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-11-06 20:20:52 +00:00
Suzy Mueller
1ab5277e83 refactor/rename: fail cleanly when attempting to rename cgo files
Previous implementation will overwrite files the import "C" with the
cgo preprocessing and renaming. Rename will now emit an error when
rename must edit files that import "C". Will also emit more useful
error when using -offset in a "C" importing file.

Fixes golang/go#17839

Change-Id: I072100b22197ec145b56d727feca58be7529e359
Reviewed-on: https://go-review.googlesource.com/45930
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-06-23 01:23:57 +00:00
Josh Bleecher Snyder
aaeb897338 refactor/rename: add line number to ambiguityError
Updates golang/go#19906

Change-Id: If13c828541cdb3937e5e970dd8add7615d36d866
Reviewed-on: https://go-review.googlesource.com/40171
Reviewed-by: David R. Jenni <david.r.jenni@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-05-10 14:27:37 +00:00
David R. Jenni
4968197297 x/tools/refactor/rename: fix nil pointer dereference.
Fix a nil pointer dereference by checking the error returned by
conf.Load.

Bug was reported on Reddit:
https://www.reddit.com/r/golang/comments/5vo0fb/

Change-Id: I2ad6f03922b772f03e282a0af6eea24f8de9cef8
Reviewed-on: https://go-review.googlesource.com/37432
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-24 20:12:46 +00:00
Alan Donovan
b56ef30191 tools: updates for minimum Go version 1.6
Details:
- remove go1.5 "default version" labels on most files
- remove go1.6 labels on a few files
- go/loader: use conf.Cwd not "." in a couple places; update faulty
  test expectations.  (Not sure why this wasn't caught sooner.)
- go/ssa/interp: add 'mono' result to time.now intrinsic
- go/gcimporter15/bimport.go: make consistent with the version in gc
- go/ssa/interp: update test error message
- go/ssa: update a comment

The go/gcimporter15/bexport.go logic is stale and needs to be brought
up to date.  Needs a separate CL since it's tricky.

Tested on go1.6, go1.7, go1.8.

Change-Id: I841189d30e131b7c49a4e8690ea7c40b55041bae
Reviewed-on: https://go-review.googlesource.com/36540
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-07 21:06:19 +00:00
Zac Bergquist
cbfb669053 refactor/rename: perform renaming in doc comments
Attempt to update doc comments when renaming an identifier.
This reduces the amount of manual steps that need to be taken
when using gorename.

All occurrences of the old identifier are updated in the doc.
The update is done  using a regex to ensure that we replace
whole word matches only.

Fixes golang/go#17994

Change-Id: I4265021b5b34cf7d70bf43ad6ceee74ec132f185
Reviewed-on: https://go-review.googlesource.com/33452
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-29 19:07:26 +00:00
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
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
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
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
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
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
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
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
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
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
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
Michael Matloob
d29758bc2e cmd/gomvpkg: fix import rewrites for top-level moved package
The top-level moved package was skipped when doing import rewrites.
Don't skip that package.

Fixes #9811

Change-Id: I1c524ed44606586b5231e5adb6168079aa0e0228
Reviewed-on: https://go-review.googlesource.com/4470
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-11 15:58:22 +00:00
Alan Donovan
0dda50d42a go/loader: improve robustness in face of input errors
Before this change, many kinds of error would cause the loader to stop.
    making it brittle when analyzing large codebases, as in "godoc -analysis".

    This change moves operations that used to occur during
    configuration---(*build.Context).Import, loading, and parsing of
    initial packages---into the Load call, and ensures that all failures
    during Loading are reported at the end so that the maximum amount of
    progress is made.

    Also: redesign the tests and add many new cases.

Change-Id: Ia8cd99416af7c5d4a5fe133908adfa83676d401f
Reviewed-on: https://go-review.googlesource.com/3626
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-02 20:01:59 +00:00
Alan Donovan
84312aa521 refactor/rename: clarify usage message
In the example, we use backslashes (not single quotes) to escape
double-quotes since it works on both Windows and POSIX.

Change-Id: Id883f5457bec4d8a36d5b12c759ad385125a98a6
Reviewed-on: https://go-review.googlesource.com/2862
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-23 18:40:31 +00:00
Alex Brainman
2ef5a0d23b refactor/rename: make tests pass on windows (fixes build)
- use import path not file path in go/buildutil.FakeContext OpenFile;
- use regexp to compare error messages in TestErrors, because
  they contain windows file paths;
- use OS file path (not unix path), when checking move results
  in TestMoves.

Change-Id: Ib62d344acb551fb612d8a0773ae1ab5f18341294
Reviewed-on: https://go-review.googlesource.com/3171
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-23 05:30:55 +00:00
Alan Donovan
4d45c85020 go/types: expose IsInterface predicate, eliminating 6 copies
Change-Id: I3704d7bd7a11f691c66556c1b77ef79a503d2fe9
Reviewed-on: https://go-review.googlesource.com/2173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-21 18:49:27 +00:00
Dominik Honnef
4a084c7791 refactor/rename: allow passing -force flag from Emacs
Change-Id: Iac9355bc8a98cf61cb3d4ff871723ce466d38531
Reviewed-on: https://go-review.googlesource.com/2912
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-20 22:08:13 +00:00