Skip to content

Commit 4256834

Browse files
committed
assert, assert/cmp: un-deprecate assert.ErrorType for now
Commit 043b579 deprecated these functions, marking assert.ErrorIs as a replacement. Unfortunately, assert.ErrorIs is not a drop-in replacement for various situations, or requires quite some additional boilerplating to be used. This patch reverts the deprecation for now, but keeps recommendations in place to consider ErrorIs for situations that allow it. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 9aa7888 commit 4256834

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

assert/assert.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,6 @@ func ErrorContains(t TestingT, err error, substring string, msgAndArgs ...interf
284284
// must be called from the goroutine running the test function, not from other
285285
// goroutines created during the test. Use [Check] with [cmp.ErrorType] from other
286286
// goroutines.
287-
//
288-
// Deprecated: Use [ErrorIs]
289287
func ErrorType(t TestingT, err error, expected interface{}, msgAndArgs ...interface{}) {
290288
if ht, ok := t.(helperT); ok {
291289
ht.Helper()

assert/cmp/compare.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ func isNil(obj interface{}, msgFunc func(reflect.Value) string) Comparison {
286286
}
287287

288288
// ErrorType succeeds if err is not nil and is of the expected type.
289+
// New code should use [ErrorIs] instead.
289290
//
290291
// Expected can be one of:
291292
//
@@ -306,8 +307,6 @@ func isNil(obj interface{}, msgFunc func(reflect.Value) string) Comparison {
306307
// reflect.Type
307308
//
308309
// Fails if err does not implement the [reflect.Type].
309-
//
310-
// Deprecated: Use [ErrorIs]
311310
func ErrorType(err error, expected interface{}) Comparison {
312311
return func() Result {
313312
switch expectedType := expected.(type) {

0 commit comments

Comments
 (0)