I see some code like:

   
          r.NotFoundHandler =http.HandlerFunc(notfound)

Where notfound() has the signature of 

          func notfound(w http.ResponseWriter, r *http.Request)

What is HandlerFunc() doing? It’s not a function. Is it some sort of type 
coercion or casting?

I can see how casting that might work with simple values (e.g.numbers,integers, 
etc)  but functions?

The web docs say:
    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.

If notfound() is ' func notfound(w http.ResponseWriter, r *http.Request)’, what 
is it being converted into?

Why is this needed?

Thanks,

Joe

-- 
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/C594C073-3DF8-4CD1-8C43-59AE59AADF92%40via.net.

Reply via email to