Go net/Error には Temoprary() メソッドが実装してある
Go のパッケージ net には Error インタフェースが用意されているのだが code:net.go
type Error interface {
error
Timeout() bool // Is the error a timeout?
// Deprecated: Temporary errors are not well-defined.
// Most "temporary" errors are timeouts, and the few exceptions are surprising.
// Do not use this method.
Temporary() bool
}
のように Temporary() が用意されている
Errorがこのインタフェースを充足していれば、Temopraryエラーであると考えても良い
が、Deprecated ではある
Temporaryの意味はあいまいで、利用者の意図した通りの結果を得られるとは限りません。
go-retry の話に戻れば、もしエラーが Temporary を充足していれば一時エラーとして使用する、Timeout を充足していればタイムアウトエラーとして使用するということができそう