Skip to content

Add SelectorName in UncheckedError #197

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

Merged
merged 1 commit into from
Feb 25, 2021
Merged

Conversation

SVilgelm
Copy link
Contributor

Added a SelectorName field in the UncheckedError struct to store the original func name.

We cannot integrate the errchecker linter with the golangci-lint tool without this changes, we have an additional exclude of os.Stdout|Stderr.Write, but the fullName function returns (*os.File).Write and ignoring os.File is not acceptable.

@SVilgelm
Copy link
Contributor Author

@kisielk Could you please review this? One more attempt to integrate with golangci-lint

@kisielk
Copy link
Owner

kisielk commented Feb 25, 2021

Looks good to me. Would you mind also adding a test to the test suite?

@SVilgelm
Copy link
Contributor Author

Looks good to me. Would you mind also adding a test to the test suite?

sure, will add

@SVilgelm
Copy link
Contributor Author

@kisielk I added a very simple test, that the original line should contain the selectorName. Is it good enough?

@kisielk
Copy link
Owner

kisielk commented Feb 25, 2021

That is ok for now I think. The tests need a bit of a revamp to look for the specific test data anyway.. Let me check with the other maintainers if this change is ok then we can merge.

@SVilgelm
Copy link
Contributor Author

Thanks

Copy link
Collaborator

@dtcaciuc dtcaciuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically what Kamil already said, current check seems more like a smoke test, but doesn't look like we can do much more without involved refactoring. LGTM

@SVilgelm
Copy link
Contributor Author

we can write a test to test only the selectorName function, but I didn't;t figure out how to properly create the ast Tree to cover all cases. I will try to work on it

@kisielk
Copy link
Owner

kisielk commented Feb 25, 2021

@SVilgelm I wouldn't worry about it for now, I don't really want to test un-exported functions, we just need to go through and restructure the existing tests.

@kisielk kisielk merged commit 4174a4a into kisielk:master Feb 25, 2021
@SVilgelm SVilgelm deleted the selector-name branch February 25, 2021 02:49
@SVilgelm
Copy link
Contributor Author

@kisielk @dtcaciuc thank you! It works fine: golangci/golangci-lint#1319
Could you please release a new version?

@kisielk
Copy link
Owner

kisielk commented Feb 25, 2021

I've tagged v1.6.0

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.

3 participants