Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve io.Discard for defer #45

Open
kamilsk opened this issue Feb 20, 2021 · 1 comment
Open

improve io.Discard for defer #45

kamilsk opened this issue Feb 20, 2021 · 1 comment
Assignees

Comments

@kamilsk
Copy link
Member

kamilsk commented Feb 20, 2021

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
@kamilsk kamilsk added help wanted Extra attention is needed. difficulty: easy labels Feb 20, 2021
@kamilsk kamilsk self-assigned this Feb 20, 2021
@kamilsk
Copy link
Member Author

kamilsk commented Feb 20, 2021

and write docs with tests

@kamilsk kamilsk removed the help wanted Extra attention is needed. label May 11, 2022
@kamilsk kamilsk moved this to Backlog in 🏗 Platform May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant