The reason you write a line like this: var _ http.Handler = handler in Go is to ensure that the handler's type implements the interface http.Handler. Hence the comment above. It's part of the test to ensure the type of the error handler's return implements the interface. In the current code it returns the http.Handler interface which is fine, but it may change one day and so I don't think this change is necessary/good.
The reason you write a line like this:
var _ http.Handler = handler
in Go is to ensure that thehandler
's type implements the interfacehttp.Handler
. Hence the comment above. It's part of the test to ensure the type of the error handler's return implements the interface. In the current code it returns the http.Handler interface which is fine, but it may change one day and so I don't think this change is necessary/good.