diff --git a/.golangci.yml b/.golangci.yml index 13a8575..fb42693 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,10 +8,6 @@ linters: - paralleltest - ineffassign - - - - linters-settings: gci: custom-order: true diff --git a/common/exceptions/timeout.go b/common/exceptions/timeout.go index fbd8946..f2ae6c3 100644 --- a/common/exceptions/timeout.go +++ b/common/exceptions/timeout.go @@ -1,17 +1,22 @@ package exceptions -import "net" +import ( + "errors" + "net" +) type TimeoutError interface { Timeout() bool } func IsTimeout(err error) bool { - if netErr, isNetErr := err.(net.Error); isNetErr { + var netErr net.Error + if errors.As(err, &netErr) { //goland:noinspection GoDeprecation //nolint:staticcheck return netErr.Temporary() && netErr.Timeout() - } else if timeoutErr, isTimeout := Cast[TimeoutError](err); isTimeout { + } + if timeoutErr, isTimeout := Cast[TimeoutError](err); isTimeout { return timeoutErr.Timeout() } return false