1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:14:41 -07:00
go/refactor
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
..
eg refactor/eg: fix crash while unifying wildcard with KeyValueExpr, which has no type 2015-05-29 16:42:57 +00:00
importgraph refactor/importgraph: don't ignore imports in packages with errors. 2015-06-26 20:29:59 +00:00
lexical go/types: change {Type,Object,Selection}String to accept a Qualifier function 2015-06-30 19:00:00 +00:00
rename refactor/importgraph: don't ignore imports in packages with errors. 2015-06-26 20:29:59 +00:00
satisfy go/types: move MethodSetCache into package go/types/typeutil 2015-06-05 17:34:01 +00:00
README go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00

golang.org/x/tools/refactor: libraries for refactoring tools.