You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[survey] Why HandlerFunc use value receiver instead of pointer #30
When looking at apex/log's code (which use a net/http like handler style instead of logrus like formatter writer style), found the handy util type HandlerFunc func... which also appears in net/http
typeHandlerinterface {
ServeHTTP(ResponseWriter, *Request)
}
// The HandlerFunc type is an adapter to allow the use of// ordinary functions as HTTP handlers. If f is a function// with the appropriate signature, HandlerFunc(f) is a// Handler that calls f.typeHandlerFuncfunc(ResponseWriter, *Request)
// ServeHTTP calls f(w, r).func (fHandlerFunc) ServeHTTP(wResponseWriter, r*Request) {
f(w, r)
}
The question is, why use func (f HandlerFunc) instead of func (f *HandlerFunc)
Activity
[doc][log] Add survey for apex/log #26
[httpclient] Fix context error handle override