2 ms·
To add to what jerf already said - This is a linter, so it should be taken with a grain of salt. Having said that though, I'm trying really hard to make it con
by mvdan 11y ago
To add to what jerf already said - This is a linter, so it should be taken with a grain of salt.
Having said that though, I'm trying really hard to make it conservative and not have any false positives. I always discard functions that may be implementing interface methods or declared function types, for example.
Is this what you meant by a contract? If so, interfacer would skip the function, even if nowhere in the code is the function used to implement the interface. It's just lazy and assumes a conservative position.
If you mean it in a broader way that might not involve any interface or named function type, then we need a way for the developer to somehow express in the code that they really want that specific type. For example, I made it so that mentioned parameter types are ignored:
func ProcessInputFile(f *os.File) error {
// use as an io.Reader
}
This will not produce a suggestion.
I really want to make this tool as conservative and less noisy as possible, so if you have any ideas or a false positive example they would be very welcome.