Henry,

the case that I'm describing is when you're not exporting any and you're 
using your interface for mocking purposes. The interface cannot be called 
MockedCustomer, because it's used in the main code...there will be a 
mockCustomer struct in the test that implements the interface. The question 
I'm asking is what's your general rule to name the interface and the main 
code struct.

Although you didn't say it explicitly, I intuit you'd call the interface 
`customer` and your main code struct `customerImpl`. Is that your 
suggestion? Which would resemble option (1) in my original post, only 
suffixing rather than prefixing and on the struct rather than the interface.

On Sunday, 5 March 2017 15:07:45 UTC+13, Henry wrote:
>
> If you are exporting your interface but hiding your implementation, I 
> usually name my interface Customer and my struct customerImpl. If you are 
> using your interface for mocking purposes only, I would name it 
> MockedCustomer. If you're exporting both the interface and its 
> implementations, I would give a generic name to my interface (eg. Customer) 
> and specific names to its implementations (eg. HighPriorityCustomer, 
> SpecialNeedCustomer).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to