mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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: 6df9365a1d
GitHub-Pull-Request: golang/go#74764
Reviewed-on: https://go-review.googlesource.com/c/go/+/689920
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mark Freeman <mark@golang.org>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
This commit is contained in:
parent
e151db3e06
commit
64ba72474d
1 changed files with 4 additions and 6 deletions
|
|
@ -28,12 +28,10 @@ func Join(errs ...error) error {
|
||||||
}
|
}
|
||||||
if n == 1 {
|
if n == 1 {
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
if err != nil {
|
if _, ok := err.(interface {
|
||||||
if _, ok := err.(interface {
|
Unwrap() []error
|
||||||
Unwrap() []error
|
}); ok {
|
||||||
}); ok {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue