Skip to content

Commit

Permalink
Use %v rather than %w for t.Errorf calls
Browse files Browse the repository at this point in the history
This is to fix the following test build error:

    $ go test ./geom
    # github.com/peterstace/simplefeatures/geom_test
    geom/alg_set_op_test.go:990:7: (*testing.common).Errorf does not support error-wrapping directive %w
    geom/ctor_options_test.go:41:5: (*testing.common).Errorf does not support error-wrapping directive %w
    FAIL    github.com/peterstace/simplefeatures/geom [build failed]
    FAIL

Note that this error only seems to occur with go1.18. I'm not really
sure why this is coming up as an actual compile error rather than a vet
warning (I haven't looked into it).
  • Loading branch information
peterstace committed Mar 17, 2022
1 parent 84871fd commit 44a87b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion geom/alg_set_op_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ func TestBinaryOpNoCrash(t *testing.T) {
} {
t.Run(op.name, func(t *testing.T) {
if _, err := op.op(gA, gB); err != nil {
t.Errorf("unexpected error: %w", err)
t.Errorf("unexpected error: %v", err)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion geom/ctor_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestDisableValidation(t *testing.T) {
_, err = geom.UnmarshalWKT(wkt, geom.DisableAllValidations)
if err != nil {
t.Logf("wkt: %v", wkt)
t.Errorf("disabling validations still gave an error: %w", err)
t.Errorf("disabling validations still gave an error: %v", err)
}
})
}
Expand Down

0 comments on commit 44a87b3

Please sign in to comment.