Skip to content

Commit

Permalink
Convert %w verb in t.Errorf function to %v
Browse files Browse the repository at this point in the history
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 golang/go#47641

Fix: #430
  • Loading branch information
eclipseo committed Jan 14, 2022
1 parent fbe360a commit 2fd3523
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mountstats_test.go
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion swaps_test.go
Expand Up @@ -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) {
Expand Down

0 comments on commit 2fd3523

Please sign in to comment.