[go-nuts] fmt.Fprint or io.WriteString for http.ResponseWriter write?

2019-04-21 Thread José Colón
Hi gophers! Is it better to (w is an http.ResponseWriter) fmt.Fprint(w, "Hello world") or to io.WriteString(w, "Hello world") or doesfmt.Fprint use io.WriteString behind the scenes, and thus they are equivalent? -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] fmt.Fprint or io.WriteString for http.ResponseWriter write?

2019-04-21 Thread Christian Staffa
When you check out the source code both, fmt.Fprint and io.WriteString, need a writer as the first argument. Writer is an interface type which provides an Write method. And thats exactly what that functions are calling.. the Write method of your provided w (which is http.ResponseWriter in your c