wiki: CodeReviewComments change #33228
Labels
Documentation
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Hello,
I suggest an example to be added to explain why interface constructor should return the struct not the interface type itself
The edit to be added on CodeReviewComments #interfaces
Go interfaces generally belong in the package that uses values of the interface type, not the package that implements those values. The implementing package should return concrete (usually pointer or struct) types: that way, new methods can be added to implementations without requiring extensive refactoring, **and this will enable the struct to implement more than one interface and be accepted/evaluated to all of them in different functions**
The code example
https://play.golang.org/p/zZU0rFzjuEm
The text was updated successfully, but these errors were encountered: