• Alan Donovan's avatar
    go/types: change {Type,Object,Selection}String to accept a Qualifier function · f11109fb
    Alan Donovan authored
    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
    
    This CL is a copy of https://go-review.googlesource.com/#/c/11692/
    to the golang.org/x/tools repository.
    
    Change-Id: I26d0f3644d077a26bfe350989f9c545f018eefbf
    Reviewed-on: https://go-review.googlesource.com/11790Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    Run-TryBot: Robert Griesemer <gri@golang.org>
    f11109fb
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...