Function Types in Go
A while ago, I saw a question in a Go developer Slack channel that went something like this (translated):
When would you want to define a function type like type MyFunc func(msg string) error? Do you have any examples?
I replied with a http.HandlerFunc example (more on that below), but there were many developers smarter than me in that Slack channel, and I ended up learning a lot from the other answers to this question. This article will cover what I took away from the ensuing discussion.
kinbiko.com