Many programs will be outputting the their errors directly onto stdout/stderr, and then ingesting these logs with some form of log aggregation tool (Logstash/Splunk/...). With multi-line errors, this requires configuring these tools to recognize log entries spanning multiple lines. To make this easier, it might make sense to have a common prefix on all following lines, rather than alternating spaces and triple-dash as in the examples:
write users database:
more detail here
/path/to/database.go:111
--- call myserver.Method:
/path/to/grpc.go:222
--- dial myserver:3333:
/path/to/net/dial.go:333
--- open /etc/resolv.conf:
/path/to/os/open.go:444
--- permission denied
It might still make sense to mark where one wrapped error begins and ends, but having some marker that is simple and consistent would make running Go 2 programs in environments with log collection easier.
There are multiple way about this.
For instance "% +v" could print 2 or so extra space on each subsequent line:
or