I donβt understand why we use capture, since I can write something directly into the body of the answer, can anyone explain this?
func writeSome(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "write some thing") }
he is the same:
func hijack(w http.ResponseWriter, r *http.Request) { hj, _ := w.(http.Hijacker) _, buf, _ := hj.Hijack() buf.WriteString("write some thing") buf.Flush() }
I'm confused
source share