• Russ Cox's avatar
    cmd/doc: adapt directory search for modules · b7d3f4c0
    Russ Cox authored
    Previously, cmd/doc treated GOROOT/src and GOPATH/src
    as the roots of the directory trees holding packages, assuming
    that the import path would be the path elements after the src directory.
    
    With modules, each module serves as its own root of a file tree,
    and the import path prefix starts with the module path before
    adding the path elements after the module root.
    
    There are ways we could make this more efficient,
    but for now this is a fairly small adjustment to get 'go doc'
    working OK for modules for Go 1.11.
    
    Fixes #26635.
    
    Change-Id: Ifdee4194601312846c7b1fc67f2fe7a4a44269cc
    Reviewed-on: https://go-review.googlesource.com/126799
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    b7d3f4c0
dirs.go 5.03 KB