• Daniel Martí's avatar
    all: clean up code with token.IsExported · 9b968df1
    Daniel Martí authored
    A handful of packages were reimplementing IsExported, so use
    token.IsExported instead. This caused the deps test to fail for net/rpc.
    However, net/rpc deals with Go types, and go/token is light and fairly
    low-level in terms of Go tooling packages, so that's okay.
    
    While at it, replace all uses of ast.IsExported with token.IsExported.
    This is more consistent, and also means that the import graphs are
    leaner. A couple of files no longer need to import go/ast, for example.
    
    We can't get rid of cmd/compile/internal/types.IsExported, as the
    compiler can only depend on go/token as of Go 1.4. However, gc used
    different implementations in a couple of places, so consolidate the use
    of types.IsExported there.
    
    Finally, we can't get rid of the copied IsExported implementation in
    encoding/gob, as go/token depends on it as part of a test. That test
    can't be an external test either, so there's no easy way to break the
    import cycle.
    
    Overall, this removes about forty lines of unnecessary code.
    
    Change-Id: I86a475b7614261e6a7b0b153d5ca02b9f64a7b2d
    Reviewed-on: https://go-review.googlesource.com/c/go/+/172037
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
    9b968df1
response_test.go 24 KB