Closed
Description
What version of Go are you using (go version
)?
go version go1.20rc1 darwin/arm64
What did you do?
Pasted a HTTP ResponseController usage example from Go 1.20 release notes draft:
package pkg
import (
"io"
"net/http"
"strings"
)
func RequestHandler(w http.ResponseWriter, r *http.Request) {
rc := http.NewResponseController(w)
rc.SetWriteDeadline(0) // disable Server.WriteTimeout when sending a large response
io.Copy(w, strings.NewReader("hello"))
}
https://go.dev/play/p/F16HmEJ7NUU
What did you expect to see?
No build errors.
What did you see instead?
Incorrect http.ResponseController.SetWriteDeadline call — it's called with an int constant, when this method expects time.Time type.
¶ go vet
# pkg
vet: ./pkg.go:11:22: cannot use 0 (untyped int constant) as time.Time value in argument to rc.SetWriteDeadline