]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: replace formatOutput/showOutput with reportCmd
authorAustin Clements <austin@google.com>
Fri, 15 Sep 2023 16:45:17 +0000 (12:45 -0400)
committerAustin Clements <austin@google.com>
Wed, 18 Oct 2023 14:06:33 +0000 (14:06 +0000)
commit7ee9980105f607641fb2d594f01a253e48abb1f4
tree348f0c5703fb27ef8e256250c944ab329e0a16b6
parent5ae9724d905ae3257e072ef7746234e2e3c034e4
cmd/go: replace formatOutput/showOutput with reportCmd

The general pattern is to replace

if len(cmdOut) > 0 {
output := b.processOutput(cmdOut)
if err != nil {
err = formatOutput(b.WorkDir, dir, p.ImportPath, desc, output)
} else {
b.showOutput(a, dir, desc, output)
}
}
if err != nil {
return err
}

with

if err := b.reportCmd(a, p, desc, dir, cmdOut, err); err != nil {
return err
}

However, there is a fair amount of variation between call sites. The
most common non-trivial variation is sites where errors are an
expected outcome. In this case, often we simply pass "nil" for the
error to trigger only the printing behavior of reportCmd.

For #62067, but also a nice cleanup on its own.

Change-Id: Ie5f918017c02d8558f23ad4c38261077c0fa4ea3
Reviewed-on: https://go-review.googlesource.com/c/go/+/529219
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/work/cover.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/go/internal/work/gccgo.go
src/cmd/go/testdata/script/list_pkgconfig_error.txt