Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: chain.Unwrap behaviour #53

Open
rickb777 opened this issue Sep 10, 2021 · 0 comments
Open

Question: chain.Unwrap behaviour #53

rickb777 opened this issue Sep 10, 2021 · 0 comments

Comments

@rickb777
Copy link

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:

// 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant