-
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: private structs with single interface #31
Comments
Make sense to me. I will implement this check soon. P/S/ |
This should be controlled by a flag I use this feature returning a private struct and use its interface on the client side. It is common approach when you declare interfaces on the client side client.go package client
import "impl"
type IFace interface {
Do()
}
instance := impl.New() impl.go package impl
type privateImpl struct {
}
func (*privateImpl) Do() {
}
func New() *privateImpl {
return &privateImpl{}
} |
@nava do you use this linter as it is or a part of |
Yes, of course |
Сергей, вы не поняли мой вопрос: вы используете ireturn в стендалон режиме (как отдельную бинарную программу илиже в составе golangci-lint? |
Я все правильно понял - "да, конечно" в составе golangci-lint |
Returning private structs, as this linter advises, is cumbersome to the caller. They are private for a reason, so a caller should be interested only in behavior (interface).
Linter should allow returning public interface instead of private type with single interface.
Also, worth adding that returning private structs is considered an error by revive linter.
Implementing this will likely resolve #21
The text was updated successfully, but these errors were encountered: