Replace errors.Cause() with errors.Is()
Dependencies may be switching to use the new `%w` formatting option to wrap errors; switching to use `errors.Is()` makes sure that we are still able to unwrap the error and detect the underlying cause. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -317,7 +317,7 @@ func TestBreakouts(t *testing.T) {
|
||||
if err == nil {
|
||||
return errors.New("files are the same, expected diff")
|
||||
}
|
||||
if errors.Cause(err) != errFileDiff {
|
||||
if !errors.Is(err, errFileDiff) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -932,7 +932,7 @@ func makeWriterToTarTest(wt tartest.WriterToTar, a fstest.Applier, validate func
|
||||
if _, err := Apply(context.Background(), td, tr); err != nil {
|
||||
if applyErr == nil {
|
||||
t.Fatalf("Failed to apply tar: %v", err)
|
||||
} else if errors.Cause(err) != applyErr {
|
||||
} else if !errors.Is(err, applyErr) {
|
||||
t.Fatalf("Unexpected apply error: %v, expected %v", err, applyErr)
|
||||
}
|
||||
return
|
||||
|
Reference in New Issue
Block a user