mirror of
https://github.com/golang/go
synced 2024-11-18 12:24:48 -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:
parent
a69ece7231
commit
3fc6159fa3
@ -740,6 +740,11 @@ func fakeContext(pkgs map[string][]string) *build.Context {
|
|||||||
index, _ := strconv.Atoi(strings.TrimSuffix(base, ".go"))
|
index, _ := strconv.Atoi(strings.TrimSuffix(base, ".go"))
|
||||||
return ioutil.NopCloser(bytes.NewBufferString(pkgs[dir][index])), nil
|
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
|
return &ctxt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user