This commit is contained in:
withchao
2023-02-10 19:17:33 +08:00
parent 4b3d965783
commit 09c6fbdfe4
10 changed files with 415 additions and 410 deletions
+13
View File
@@ -412,3 +412,16 @@ func (o *sortSlice[E]) Swap(i, j int) {
type Ordered interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string
}
func Unwrap(err error) error {
for err != nil {
unwrap, ok := err.(interface {
Unwrap() error
})
if !ok {
break
}
err = unwrap.Unwrap()
}
return err
}