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

Check the err returned by AddRequire #3583

Merged
merged 2 commits into from
Apr 29, 2021
Merged

Check the err returned by AddRequire #3583

merged 2 commits into from
Apr 29, 2021

Conversation

jeffwidman
Copy link
Member

Looking at the source of AddRequire, it looks like it never actually returns a non-nil error: https://github.com/golang/mod/blob/858fdbee9c245c8109c359106e89c6b8d321f19c/modfile/rule.go#L828-L846

However, they wrote the func signature to return an err to give themselves future flexibility.

So we should respect that and check for any unexpected errors. This way future updates that
suddenly start returning errors will be caught rather than insidiously slipping by and causing
difficult-to-debug issues elsewhere.

Looking at the source of `AddRequire`, it looks like it never actually returns a non-`nil` error.

However, they wrote the func signature to return an `err` to give themselves future flexibility.

So we should respect that and check for any unexpected errors. This way future updates that
suddenly start returning errors will be caught rather than insidiously slipping by and causing
difficult-to-debug issues elsewhere.
go_modules/helpers/updater/main.go Outdated Show resolved Hide resolved
@thepwagner thepwagner self-assigned this Apr 29, 2021
@thepwagner thepwagner merged commit 22c6916 into dependabot:main Apr 29, 2021
@thepwagner thepwagner mentioned this pull request Apr 29, 2021
@jeffwidman jeffwidman deleted the patch-1 branch April 29, 2021 17:35
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

Successfully merging this pull request may close these issues.

2 participants