• Rob Pike's avatar
    cmd/doc: add a -src flag to show original source · 294d16c9
    Rob Pike authored
    It's long-desired but was blocked by #26835. That is now fixed, so
    it's easy. When -src is off, we behave as before. But with -src
    set, initialize the go/doc package to preserve the original AST and
    things flow very easily.
    
    With -src, since you're seeing inside the package source anyway it
    shows unexported fields and constants: you see the original source.
    But you still need -u to ask about them.
    
    Fixes #18807
    
    Change-Id: I473e90323b4eff0735360274dc0d2d9dba16ff8b
    Reviewed-on: https://go-review.googlesource.com/c/140959Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Run-TryBot: Andrew Gerrand <adg@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    294d16c9
doc_test.go 22.5 KB