This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Description
Example in http://dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package
f, err := os.Open(path)
if err != nil {
return errors.Wrapf(err, "failed to open %q", path)
}
is actually good example why Wrap() should be variadic - os.PathError already contains Op and Path, so there is no sense to add same thing once again, all we need here is add stack details.
Another example is jsonrpc2.Error type. It is somewhat unusual because it's Error() returns error details serialized into JSON (this is needed to pass thru net/rpc internals while keeping error details). So, if we do errors.Wrap(jsonrpc2_err_here, "") and then net/rpc will internally call Error() then we'll get ": {…json here…}" and that's extra ": " prefix will break restoring error details when it comes out from net/rpc.
Providing variadic errors.Wrap(err) which didn't add any prefix will solve both issues.