Skip to content

Instantly share code, notes, and snippets.

@b0o
Created September 26, 2018 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b0o/b9c4d4320a0237a80e7363ee6ab3022f to your computer and use it in GitHub Desktop.
Save b0o/b9c4d4320a0237a80e7363ee6ab3022f to your computer and use it in GitHub Desktop.
for {
buf := make([]byte, 1024*4)
n, err := res.Body.Read(buf)
if err == io.EOF {
break
}
cbuf <- buf[:n]
select {
case <-cquit:
err = fmt.Errorf("force quit")
break
default:
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment