When to use generics
&gt;<i>For type parameters, prefer functions to methods<p>&gt;The Tree example illustrates another general guideline: when you need something like a comparison function, prefer a function to a method.<p>&gt;We could have defined the Tree type such that the element type is required to have a Compare or Less method. This would be done by writing a constraint that requires the method, meaning that any type argument used to instantiate the Tree type would need to have that method.</i><p>Yes yes a thousand times yes.<p>If you have an interface with a single method, or something with a single varying piece of behavior, please <i>strongly</i> consider accepting a function instead.  Going from method to function is trivial - pass `thing.method`.  Going the other way <i>is impossible at runtime</i>, it requires package-level code at compile-time.<p>This is true for many&#x2F;most? languages, but it feels like a lot of Go libraries have forgotten it, and they&#x27;re sometimes a huge unnecessary pain to deal with for that reason.