Sorry, but I believe that explanation is wrong. http.HandlerFunc is a type, not a function: https://golang.org/pkg/net/http/#HandlerFunc
And so the code shown by the OP is indeed performing a type conversion, to a compatible type which is decorated with methods. You can do the same with plain types like "int": see https://play.golang.org/p/EaN8AtzQuhm A type of "function taking X returning Y" is no different in this regard. So whilst it's true that Go supports functions returning functions, this is not what's happening here. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b7122370-b096-4e6c-b911-6be57fa25e2a%40googlegroups.com.