As far as I know, there are three ways you can deal with this.

First, you can introduce a dummy private method in your interface, so as to 
differentiate it from other interfaces. The implementing struct will need to 
implement this dummy method. I don't like this approach for one bit, because it 
feels like a hack.

The second approach -which I prefer- is to avoid a potential naming conflict by 
having a proper naming convention. I usually use the verb+noun pattern for my 
method/function name. The noun describes either the input parameter or the 
output. 

There are exceptions to this pattern. When the verb is 'get' and using any 
other verbs would be awkward, then it uses only the noun. Another exception is 
when dealing with constructors, which always start with 'New'.

The last approach is to do nothing. As long as you properly name your 
variables, it is hardly unlikely that you are going to get Animal and File 
mixed up. 

-- 
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