I have the most basic net/http program that I\'m using to learn the namespace in Go:
package main
import (
\"fmt\"
\"log\"
\"net/http\"
)
func
You already received a correct answer which addresses your problem, I will give some information about the general case (such error appears often).
From the documentation, you see that WriteHeader sends an http status code and you can't send more than 1 status code. If you Write anything this is equivalent to sending 200 status code and then writing things.
So the message that you see appears if you either user w.WriteHeader more than once explicitly or uses w.Write before w.WriteHeader.