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

Suppress reports from unexported interface methods #52

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Suppress reports from unexported interface methods #52

merged 1 commit into from
Jul 16, 2024

Conversation

MichaelUrman
Copy link
Contributor

When an interface method is not exported, its only implementations will be local to the module under analysis. Thus the implementations can be checked, and the caller can assume the error was wrapped.

This reasoning does not apply to exported interface methods, even if the interface happens to also have an unexported method. (An implementation can override just the public methods by embedding the interface or a struct that implements it.)

Resolves #50

When an interface method is not exported, its only implementations will
be local to the module under analysis. Thus the implementations can be
checked, and the caller can assume the error was wrapped.

This reasoning does not apply to exported interface methods, even if the
interface happens to also have an unexported method. (An implementation
can override just the public methods by embedding the interface or a
struct that implements it.)
@MichaelUrman
Copy link
Contributor Author

Hi @tomarrell, here's the requested PR. It deserves a bit more thought about whether there are untested cases that this will incorrectly ignore. On the bright side, what's there so far is quite simple.

@tomarrell
Copy link
Owner

Looks good to me. Thanks for the contribution!

@tomarrell tomarrell merged commit 4a8f079 into tomarrell:master Jul 16, 2024
1 check passed
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.

Unexported interface methods are internal
2 participants