cmd/go: consolidate showOutput, formatOutput, and processOutput into reportCmd
Many uses of showOutput, formatOutput, and processOutput follow a very
similar (somewhat complex) pattern. Places that diverge from this
pattern are often minor bugs. Furthermore, the roles of formatOutput
and processOutput have somewhat blurred over time; e.g., formatOutput
performs directory shortening, while processOutput performs cgo
demangling.
This CL consolidates all of this logic into a single, new function:
Builder.reportCmd.
In the following CL, we'll replace all calls of the three original
functions with reportCmd.
In addition to being a nice cleanup, this puts us in a much better
position to change how build output is formatted in order to support
`go build -json`.