-
Notifications
You must be signed in to change notification settings - Fork 3
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
ignoreCase: factory methods #21
Comments
Any update on this? We'd love to help :) Here's a minimal example: // main.go
package main
type Foo interface {
DoStuff()
}
type FooFactory interface {
NewFoo() Foo
}
type MyFooFactory struct {}
func (f *MyFooFactory) NewFoo() Foo {
return nil
} Running the linter: ireturn main.go Yields this error:
Factories are a pretty common pattern, so we'd like for Currently we can configure ireturn --allow=Foo main.go However this has two drawbacks:
We would love for Is there any chance that we could add an |
Hi. Thank you for commenting on this issue, its kinda related to the #91. Our problem is we are tracking tunction declarations, not function calls, so we can't determine what is calling - interface or struct (this comment regarding propose in #91). And looking up for any other type declaration to find out (is it suppose to be interface declaration) isn't going to be free. I will take a look to it, once i have some time (which I mostly doesn't have as I am in army now), but i will try to check what can be done. |
This is a comment from @drumsta, on same question asked week ago. Copied here for propose to tracking this issue. How to deal with the case below?
The above won't compile because of the error:
This use case is quite common designing libraries. As an example, standard slog package has this interface, that's Handler methods return the Handler interface.
|
add to ignore case a factory functions (ones that can return interface, depends on incoming parameters)
The text was updated successfully, but these errors were encountered: