mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/doc: use empty GOPATH when running the tests
Otherwise, a populated GOPATH might result in failures such as: $ go test [...] no buildable Go source files in [...]/gopherjs/compiler/natives/src/crypto/rand exit status 1 Move the initialization of the dirs walker out of the init func, so that we can control its behavior in the tests. Updates #24464. Change-Id: I4b26a7d3d6809bdd8e9b6b0556d566e7855f80fe Reviewed-on: https://go-review.googlesource.com/101836 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
041c5d8348
commit
77c3ef6f6f
4 changed files with 16 additions and 7 deletions
|
|
@ -62,7 +62,7 @@ func (pkg *Package) prettyPath() string {
|
|||
// Also convert everything to slash-separated paths for uniform handling.
|
||||
path = filepath.Clean(filepath.ToSlash(pkg.build.Dir))
|
||||
// Can we find a decent prefix?
|
||||
goroot := filepath.Join(build.Default.GOROOT, "src")
|
||||
goroot := filepath.Join(buildCtx.GOROOT, "src")
|
||||
if p, ok := trim(path, filepath.ToSlash(goroot)); ok {
|
||||
return p
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue