]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: remove confusing TrimPrefix(str, "\n")
authorAustin Clements <austin@google.com>
Fri, 26 Jan 2024 20:06:14 +0000 (15:06 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 14 Nov 2024 15:22:44 +0000 (15:22 +0000)
It's not clear why strings here would have a *prefix* \n. This trim
was introduced back in March 2012 without explanation in omnibus
commit b03a5f66e8f8a6b36c9d67e82d2edc9b3d4076ba (as a HasPrefix, since
we didn't have TrimPrefix at the time).

Change-Id: Ib0a7af36900e437fdc52ec5c1c921f92833f6cef
Reviewed-on: https://go-review.googlesource.com/c/go/+/558638
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/internal/test/test.go

index 58c54c99e050323da560bd3e902a79246dc68769..3f4f3accaa3529893b828736c74a9d2e9aad5002 100644 (file)
@@ -993,7 +993,6 @@ func runTest(ctx context.Context, cmd *base.Command, args []string) {
                buildTest, runTest, printTest, err := builderTest(b, ctx, pkgOpts, p, allImports[p], writeCoverMetaAct)
                if err != nil {
                        str := err.Error()
-                       str = strings.TrimPrefix(str, "\n")
                        if p.ImportPath != "" {
                                base.Errorf("# %s\n%s", p.ImportPath, str)
                        } else {