hashicorp / hashicorp/go-multierror
Question: chain.Unwrap behaviour
Open
- Dominant language
- Go
- Stars
- 2.6k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
chain.Unwrap() has a test to see whether the end of the chain has been reached. I don't understand this; is it correct?
*multierror.go:*
```go
// Unwrap implements errors.Unwrap by returning the next error in the
// chain or nil if there are no more errors.
func (e chain) Unwrap() error {
if len(e) == 1 { // line 106
return nil
}
return e[1:]
}
```
It seems to me that line 106 might have a mistake and should be ` if len(e) < 1 {`.
Have I misunderstood this?
I am using v1.1.1.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.