]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: enable file shortening for lines starting with \t
authorKeith Randall <khr@golang.org>
Mon, 14 Feb 2022 21:23:30 +0000 (13:23 -0800)
committerKeith Randall <khr@golang.org>
Mon, 14 Feb 2022 21:48:30 +0000 (21:48 +0000)
Compiler errors now (as of 1.18) might start with a tab character,
for errors which take multiple lines to report. e.g.:

/Users/khr/gowork/tmp1.go:3:15: x redeclared in this block
/Users/khr/gowork/tmp1.go:3:8: other declaration of x

This CL makes error lines starting with a tab character
eligible for replacing absolute paths with relative ones.

Fixes #51177

Change-Id: Ic9e9c610a1aa1e21e9f19e6a9bd05c73b5a14e4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/385755
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Trust: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/go/internal/work/exec.go

index 48a74458bdaf591d772ad9a163032dc53f1fa3f5..ac80f503cd89074a0f348c050486535564179c88 100644 (file)
@@ -2013,6 +2013,7 @@ func (b *Builder) showOutput(a *Action, dir, desc, out string) {
        if reldir := base.ShortPath(dir); reldir != dir {
                suffix = strings.ReplaceAll(suffix, " "+dir, " "+reldir)
                suffix = strings.ReplaceAll(suffix, "\n"+dir, "\n"+reldir)
+               suffix = strings.ReplaceAll(suffix, "\n\t"+dir, "\n\t"+reldir)
        }
        suffix = strings.ReplaceAll(suffix, " "+b.WorkDir, " $WORK")