▲ | 9rx 9 hours ago | |||||||||||||||||||||||||
Actual code is always better, but based on the description it seems a bit strange that there would be a single package that exports multiple implementations. Presumably each distinct implementation should be its own package. None of these packages would export the interface. An additional package would export the interface and provide the common functionality around that interface. Those common functions would be considered the consumer. In fact, the standard library offers an example of exactly this: io/fs. | ||||||||||||||||||||||||||
▲ | the_gipsy 6 hours ago | parent [-] | |||||||||||||||||||||||||
No, I cannot agree that this would be called the consumer. Yes, you have technically moved the interface type away from the implementation, but just for the sake of it, without any other upsides. The consumer is still the package that is using and importing this interface type, just from another package now. | ||||||||||||||||||||||||||
|