r/backtickbot • • May 23 '21

https://np.reddit.com/r/golang/comments/niv6ax/stdlib_of_pipewrite_why_it_has_the_line_b_bnw/gz4sk57/

And another question - why do we need once here? Looks like without it will be the same:

	for ; len(b) > 0; {
		select {
		case p.wrCh <- b:
			nw := <-p.rdCh
			b = b[nw:] // WHY?
			n += nw
		case <-p.done:
			return n, p.writeCloseError()
		}
	}
0 Upvotes

0 comments sorted by