]> Cypherpunks repositories - gostls13.git/commit
cmd/doc: adapt directory search for modules
authorRuss Cox <rsc@golang.org>
Mon, 30 Jul 2018 18:53:44 +0000 (14:53 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 1 Aug 2018 00:35:28 +0000 (00:35 +0000)
commitb7d3f4c0b2f421c6b7bf6ce3533f1b34b470b39d
treeb77da8cd97280ea7a4907a10d350a44a495d54a3
parentb8f42d74e87aeec189f53e9fdb2a7e6026c099b1
cmd/doc: adapt directory search for modules

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: Rob Pike <r@golang.org>
src/cmd/doc/dirs.go
src/cmd/doc/doc_test.go
src/cmd/doc/main.go
src/cmd/doc/pkg.go
src/cmd/go/testdata/script/mod_doc.txt [new file with mode: 0644]