The Go docs have the following example for the http package:
http.Handle(\"/foo\", fooHandler)
http.HandleFunc(\"/bar\", func(w http.ResponseWriter, r *http.
Very correct answers so I won't say much but explain it in simple terms:
Problem: I want to create an object (type) that responds to HTTP requests.
Solution: use http.Handle
and the object you create should implement ServeHTTP
interface from the HTTP package.
Problem: I want a function to respond to my HTTP request.
Solution: Use http.HandleFunc
for that and register your function with the HTTP server.