Go 1.27 adds type parameters to concrete methods, but not to interface methods
The Go team explains why generic methods now exist for concrete types while generic interface methods remain unsupported.
Go 1.27 allows type parameters on concrete methods, a feature the Go blog says the community has wanted for a long time. Until now, generics worked on types and functions only, so mapping a list to another element type required a package-level function.
With generic methods, a method such as Map can be declared on a List type with its own result type, and calls can be chained from left to right instead of nested inside out. A method expression can still convert the method into a plain function if that style is preferred.
Generic methods must be instantiated before use, as with other generics in Go. They cannot be used to satisfy an interface, because generic interface methods remain unsupported.
The post explains the reason: the compiler generates code per type argument, and for an interface call across packages it could not know which instantiations to produce. Developers can start using generic methods to organize code on Go 1.27 without changing interfaces.
Sources
- Generic Methodsofficial