It took me a minute or two to figure out why, while doing some experiments, for the following built-in HTTP server use case, the handler was called two times, and so printing the log message two times.
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
log.Println("call")
})
http.ListenAndServe(":8800", nil)
}
The path “/” catches all requests, thus it catches the “/favicon.ico” request sent by the browser. So I’ve just used another path.