]> Cypherpunks repositories - gostls13.git/commit
cmd/doc: skip directories like other go tools
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 13 Apr 2018 18:39:32 +0000 (19:39 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Sat, 14 Apr 2018 21:59:08 +0000 (21:59 +0000)
commit49e3e436e71a54f16eb15960bd77ecf554ccc905
treebf30428bbcdf7ee74e487d1a6eaa41367351c59d
parenta55f9d2d912a33ce490ff2fa9ce5720346ff7b8e
cmd/doc: skip directories like other go tools

It was skipping dirs starting with ".", but it was missing the "_"
prefix and the "testdata" name. From "go help packages":

Directory and file names that begin with "." or "_" are ignored
by the go tool, as are directories named "testdata".

Before the change:

$ go doc z # using src/cmd/go/testdata/testvendor/src/q/z
package z // import "."

After the fix, it falls back to the current directory, as expected when
a single argument isn't found as a package in $GOPATH.

TestMain needs a small adjustment to keep the tests working, as now
their use of cmd/doc/testdata would normally not work.

Fixes #24462.

Change-Id: I1f5d6d1eba0fb59aff55db33b3b1147e300284ef
Reviewed-on: https://go-review.googlesource.com/106935
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
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