xerrors: gobble colon and newline in edge cases

We gobble newlines at the start of a detailed
section, at end before a new message, but not
at the end of a message. This CL add that.

Also, we should not print the colon after the last
non-detailed message if the detailed message
consists solely of newlines that are gobbled.

Change-Id: I9888253e600fa1d7a05dd61f2cc49cda4275ceb1
Reviewed-on: https://go-review.googlesource.com/c/160717
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
2 files changed