diff options
Diffstat (limited to 'src/cmd/compile')
| -rw-r--r-- | src/cmd/compile/internal/noder/reader.go | 12 | ||||
| -rw-r--r-- | src/cmd/compile/internal/ssa/debug_lines_test.go | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go index d03da27a46..bd15729171 100644 --- a/src/cmd/compile/internal/noder/reader.go +++ b/src/cmd/compile/internal/noder/reader.go @@ -9,6 +9,7 @@ import ( "go/constant" "internal/buildcfg" "internal/pkgbits" + "path/filepath" "strings" "cmd/compile/internal/base" @@ -268,13 +269,14 @@ func (pr *pkgReader) posBaseIdx(idx pkgbits.Index) *src.PosBase { // "$GOROOT" to buildcfg.GOROOT is a close-enough approximation to // satisfy this. // - // TODO(mdempsky): De-duplicate this logic with similar logic in - // cmd/link/internal/ld's expandGoroot. However, this will probably - // require being more consistent about when we use native vs UNIX - // file paths. + // The export data format only ever uses slash paths + // (for cross-operating-system reproducible builds), + // but error messages need to use native paths (backslash on Windows) + // as if they had been specified on the command line. + // (The go command always passes native paths to the compiler.) const dollarGOROOT = "$GOROOT" if buildcfg.GOROOT != "" && strings.HasPrefix(filename, dollarGOROOT) { - filename = buildcfg.GOROOT + filename[len(dollarGOROOT):] + filename = filepath.FromSlash(buildcfg.GOROOT + filename[len(dollarGOROOT):]) } if r.Bool() { diff --git a/src/cmd/compile/internal/ssa/debug_lines_test.go b/src/cmd/compile/internal/ssa/debug_lines_test.go index 6678a96e77..ff651f6862 100644 --- a/src/cmd/compile/internal/ssa/debug_lines_test.go +++ b/src/cmd/compile/internal/ssa/debug_lines_test.go @@ -222,7 +222,7 @@ func testInlineStack(t *testing.T, file, function string, wantStacks [][]int) { sortInlineStacks(gotStacks) sortInlineStacks(wantStacks) if !reflect.DeepEqual(wantStacks, gotStacks) { - t.Errorf("wanted inlines %+v but got %+v", wantStacks, gotStacks) + t.Errorf("wanted inlines %+v but got %+v\n%s", wantStacks, gotStacks, dumpBytes) } } |
