improve io.Discard for defer
kamilsk opened this issue · comments
Kamil Samigullin commented
if I use io.Discard with defer I have bad dev experience:
resp, err := http.Do(req)
if err {...}
defer safe.Close(io.Discard(resp.Body), ...) // now I can't read from body
json.NewDecoder(resp.Body).Decode() // woops
Kamil Samigullin commented
and write docs with tests