1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:54:42 -07:00

go/analysis/analysistest: fix tests on MS Windows

CL 137735 only fixed Darwin, and was submitted prematurely.

Change-Id: Idf9706ab2dc6ef716471cd6a2089bb0be63a54a2
Reviewed-on: https://go-review.googlesource.com/137835
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Alan Donovan 2018-09-26 16:17:24 -04:00
parent 34cd4017e8
commit ef4a2a23bb

View File

@ -176,5 +176,5 @@ func checkDiagnostics(t Testing, gopath string, pass *analysis.Pass, diagnostics
// typically a gnarly /tmp directory.
func sanitize(gopath string, posn *token.Position) {
prefix := gopath + string(os.PathSeparator) + "src" + string(os.PathSeparator)
posn.Filename = strings.TrimPrefix(posn.Filename, prefix)
posn.Filename = filepath.ToSlash(strings.TrimPrefix(posn.Filename, prefix))
}