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

Lint for modified Issues that are not used. #21

Closed
lgarron opened this issue Mar 25, 2016 · 2 comments
Closed

Lint for modified Issues that are not used. #21

lgarron opened this issue Mar 25, 2016 · 2 comments

Comments

@lgarron
Copy link
Collaborator

lgarron commented Mar 25, 2016

The following has no side effects:

 issues.AddError("error")

The correct way to modify issues is to assign the new value to it:

 issues = issues.AddError("error")

During development, I have occasionally written the former. Tests should help catch changes that are accidentally introduced, but it would be nice to catch modified Issues that are never used.

It would be nice to have an "unused result" warning (similar to "unused variable") at compile or test time.

I'mma look into go vet.

@lgarron
Copy link
Collaborator Author

lgarron commented Mar 26, 2016

I'mma look into go vet.

go vet has annoying limitations that prevent this use case. I've filed a bug at golang/go#14972

@lgarron
Copy link
Collaborator Author

lgarron commented May 7, 2016

We have a lot of tests to make sure the proper errors are returned under a wide variety of conditions.

@lgarron lgarron closed this as completed May 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant