FWIW the original works as well, but because you're using a
typedef (not an alias) you have to
convert from your own type to the underlying:
func (t *fishTank) fishCount() string {
return fmt.Sprintf("How many fishies? %d!", (*container[fish])(t).size())
}
that's because
type fishTank container[fish]
creates a completely new and independent type with container[fish] as the underlying implementation.
An alternative is to just alias:
type fishTank = container[fish]
however in that case you can't define methods on fishTank, because it's literally just a shorthand for container[fish].