Skip to content

Commit 64ba724

Browse files
callthingsoffgopherbot
authored andcommitted
errors: omit redundant nil check in type assertion for Join
When ok is true, err can't be nil. Make it behave more like the Unwrap function. Change-Id: Ieba5de57d60f5ff4d6a3468d703e6f72be02a97d GitHub-Last-Rev: 6df9365 GitHub-Pull-Request: #74764 Reviewed-on: https://go-review.googlesource.com/c/go/+/689920 LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Jorropo <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Mark Freeman <[email protected]> Reviewed-by: Jorropo <[email protected]>
1 parent e151db3 commit 64ba724

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/errors/join.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ func Join(errs ...error) error {
2828
}
2929
if n == 1 {
3030
for _, err := range errs {
31-
if err != nil {
32-
if _, ok := err.(interface {
33-
Unwrap() []error
34-
}); ok {
35-
return err
36-
}
31+
if _, ok := err.(interface {
32+
Unwrap() []error
33+
}); ok {
34+
return err
3735
}
3836
}
3937
}

0 commit comments

Comments
 (0)