Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/vet: check for http.ResponseWriter WriteHeader calls after body has been written #27668
What version of Go are you using (
I quickly prototyped this using the approach of the nilness checker, looking for a call to w.Header().Set() dominated by a conversion of w to io.Writer. You could go further by identifying other functions that "may write to w" while it is still a ResponseWriter.
I've attached the log of what it found in the standard library--all tests, unsurprisingly.
BTW: I hope you wrote