1
0
mirror of https://github.com/golang/go synced 2024-11-18 08:14:41 -07:00

refactor/rename: attempt to fix windows test, 2nd attempt.

Windows doesn't regard "/go/src" as an absolute path,
so we must explicitly define the virtual IsAbsPath method.

LGTM=gri
R=gri, sameer
CC=golang-codereviews
https://golang.org/cl/147100043
This commit is contained in:
Alan Donovan 2014-09-24 16:38:46 -04:00
parent a69ece7231
commit 3fc6159fa3

View File

@ -740,6 +740,11 @@ func fakeContext(pkgs map[string][]string) *build.Context {
index, _ := strconv.Atoi(strings.TrimSuffix(base, ".go"))
return ioutil.NopCloser(bytes.NewBufferString(pkgs[dir][index])), nil
}
ctxt.IsAbsPath = func(path string) bool {
// Don't rely on the default (filepath.Path) since on
// Windows, it reports our virtual paths as non-absolute.
return strings.HasPrefix(path, "/")
}
return &ctxt
}