Post

Go's errors.AsType takes an interface type, so you can test for a behaviour instead of a concrete type: errors.AsType[interface{ error; Timeout() bool }](err). On Go 1.27.3 it matches context.DeadlineExceeded, whose type has a Timeout method.

0 reposts0 likes

No replies yet.