4 ms·
An interface takes any value for which the required methods are defined on it. Methods can be defined on any type declared in the package. A type in go can be
by Laremere 12y ago
An interface takes any value for which the required methods are defined on it.
Methods can be defined on any type declared in the package.
A type in go can be a lot more that just a struct; it can be any type in the language. So while it may make sense to have values on interfaces for structs, values don't make any sense for functions, pointers, interfaces, or extensions to built in types.