From 25d5e4cba179f2a8b24f63d3e288533aefe25bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Fri, 14 Jan 2022 01:13:27 +0100 Subject: [PATCH] Convert %w verb in t.Errorf function to %v MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Go 1.18 introduced a change where only fmt.Errorf function accepts the %w verb. Other Errorf function like t.Errorf do not accept it anymore. See https://github.com/golang/go/issues/47641 Fix: #430 Signed-off-by: Robert-André Mauchin --- mountstats_test.go | 4 ++-- swaps_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mountstats_test.go b/mountstats_test.go index 09e26b98f..9fccf84ac 100644 --- a/mountstats_test.go +++ b/mountstats_test.go @@ -393,7 +393,7 @@ func TestMountStats(t *testing.T) { t.Error("expected an error, but none occurred") } if !tt.invalid && err != nil { - t.Errorf("unexpected error: %w", err) + t.Errorf("unexpected error: %v", err) } if want, have := tt.mounts, mounts; !reflect.DeepEqual(want, have) { @@ -434,7 +434,7 @@ func TestMountStatsExtendedOperationStats(t *testing.T) { r := strings.NewReader(extendedOpsExampleMountstats) _, err := parseMountStats(r) if err != nil { - t.Errorf("failed to parse mount stats with extended per-op statistics: %w", err) + t.Errorf("failed to parse mount stats with extended per-op statistics: %v", err) } } diff --git a/swaps_test.go b/swaps_test.go index 1190da72b..70db6aba6 100644 --- a/swaps_test.go +++ b/swaps_test.go @@ -102,7 +102,7 @@ func TestParseSwapString(t *testing.T) { t.Error("unexpected success") } if !tt.invalid && err != nil { - t.Errorf("unexpected error: %w", err) + t.Errorf("unexpected error: %v", err) } if !reflect.DeepEqual(tt.swap, swap) {