Combines the shared parts of stacktraces so they
take up less space. For example if error is wrapped
from similar codepath to the main error, the main error
gets the stacktrace and wrapping gets only to stacktrace
up to the point where same frame exists in main error as well.
This also means we need to be less careful about WithStack as
if error already has a longer stack from current position, it
would be ignored.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Use the pkg/errors and stack package interface to check for a stack. Use
the standard library methods to unwrap errors.
Signed-off-by: Derek McGowan <derek@mcg.dev>