http.NoBody
instead of nil
in http.NewRequest
calls GO-R400179 return ""
80 }
81
82 req, err := http.NewRequest(http.MethodGet, addr, nil)83 if err != nil {
84 return ""
85 }
http.NoBody
is an io.ReadCloser
with no bytes. Read always returns EOF
and
Close
always returns nil
.
func foo(url string) {
http.NewRequest("GET", url, nil)
}
func foo(url string) {
http.NewRequest("GET", url, http.NoBody)
}