можно определить
http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
if request.URL.Path != "/" {
writer.WriteHeader(404)
writer.Write([]byte(`not found, da xiong dei !!!`))
return
}
})
, когда доступ не нашел ресурс, он выполнится к http. HandleFunc (" / ", xxx)