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

Whitelist driver.Valuer interface #9

Open
jlengelsen opened this issue Nov 25, 2024 · 3 comments · May be fixed by #11
Open

Whitelist driver.Valuer interface #9

jlengelsen opened this issue Nov 25, 2024 · 3 comments · May be fixed by #11

Comments

@jlengelsen
Copy link

This issue is related to issue #7 which has been fixed by PR #8 in order to reduce the number of false positives in the default configuration of the linter.

The interfaces driver.Valuer and sql.Scanner from the standard library conflict with each other and are commonly implemented by the same struct. This was already mentioned in this comment #7 (comment) but somehow was not implemented in the PR.

It would be nice to add driver.Valuer to the default exclusions.

@ldez
Copy link
Collaborator

ldez commented Nov 25, 2024

Hello,

As I said in PR #8 (comment), the signatures of the SQL elements seem too "generic", it can lead to false negatives (some methods will be ignored, but they should not).

@jlengelsen
Copy link
Author

jlengelsen commented Nov 25, 2024

Hello,

As I said in PR #8 (comment), the signatures of the SQL elements seem too "generic", it can lead to false negatives (some methods will be ignored, but they should not).

Sounds like a valid point. I totally missed that comment. On the other hand the interface is part of the standard library and one could argue that its counterintuitive to use a pointer receiver on a method with the signature Value() (any, error). Though I understand it's a conflict with the purpose of the linter itself. So unless a more specific matching of method signatures is implemented its seems like this can be closed.

@ldez
Copy link
Collaborator

ldez commented Nov 25, 2024

use struct name + method name as a user option (with maybe a simple wildcard: *.MarshalJSON)
#8 (comment)

The idea of struct name and method name configuration is a good one. It’s much more usable than the full signature approach. (Maybe we can add this to the next PR.)
#8 (comment)

I think we can add an option, it will not be perfect but at least you will be able to ignore all Value methods inside your project.

@ldez ldez linked a pull request Nov 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants