errors/fmt: improve error printing in detail mode

- Add a colon after a non-detailed message if
it has details or of it is followed by another
message.

Follows the design draft.

This is more readable and more consistent
with non-detailed errors.

- Gobble newline after last detail
This results in a better API experience when
printing multiple sections consecutively.

- Allow Detail to be called more than once.

Change-Id: Ic19179cdf1479fded8b657d569cb66bd2e54467e
Reviewed-on: https://go-review.googlesource.com/c/144199
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 files changed
tree: 7cd118d872eb3e8a9b348a9d5b1bb614c51dac2c
  1. cmd/
  2. ebnf/
  3. ebnflint/
  4. errors/
  5. fsnotify/
  6. inotify/
  7. io/
  8. mmap/
  9. old/
  10. rand/
  11. shiny/
  12. shootout/
  13. utf8string/
  14. winfsnotify/
  15. .gitattributes
  16. .gitignore
  17. AUTHORS
  18. codereview.cfg
  19. CONTRIBUTING.md
  20. CONTRIBUTORS
  21. LICENSE
  22. PATENTS
  23. README.md
README.md

exp

This subrepository holds experimental and deprecated (in the old directory) packages.

The idea for this subrepository originated as the pkg/exp directory of the main repository, but its presence there made it unavailable to users of the binary downloads of the Go installation. The subrepository has therefore been created to make it possible to go get these packages.

Warning: Packages here are experimental and unreliable. Some may one day be promoted to the main repository or other subrepository, or they may be modified arbitrarily or even disappear altogether.

In short, code in this subrepository is not subject to the Go 1 compatibility promise. (No subrepo is, but the promise is even more likely to be violated by go.exp than the others.)

Caveat emptor.