Blob Blame History Raw
From 2fd3523f76ff8cb9f43c03fe04e210de6718fb34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
Date: Fri, 14 Jan 2022 01:13:27 +0100
Subject: [PATCH] Convert %w verb in t.Errorf function to %v

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
---
 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 09e26b9..9fccf84 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 1190da7..70db6ab 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) {
-- 
2.33.1