code: func infiniteTransferBuffer(q *tq.TransferQueue, available chan<- *tq.Transfer) {
  	// Stream results from q.Watch() into chan "available" via an infinite
  	// buffer.
  
  	watch := q.Watch()
  
  	// pending is used to keep track of an ordered list of available
  	// `*tq.Transfer`'s that cannot be written to "available" without
  	// blocking.
  	var pending []*tq.Transfer
  
  	for {
  		if len(pending) > 0 {
  			select {
  			case t, ok := <-watch:
  				if !ok {
  					// If the list of pending elements is
  					// non-empty, stream them out (even if
  					// they block), and then close().
  					for _, t = range pending {
  						available <- t
  					}
  					close(available)
  					return
  				}
  				pending = append(pending, t)
  			case available <- pending[0]:
  				// Otherwise, dequeue and shift the first
  				// element from pending onto available.
  				pending = pending[1:]
  			}
  		} else {
  			t, ok := <-watch
  			if !ok {
  				// If watch is closed, the "tq" is done, and
  				// there are no items on the buffer.  Return
  				// immediately.
  				close(available)
  				return
  			}
  
  			select {
  			case available <- t:
  			// Copy an item directly from <-watch onto available<-.
  			default:
  				// Otherwise, if that would have blocked, make
  				// the new read pending.
  				pending = append(pending, t)
  			}
  		}
  	}
  }
docs: // infiniteTransferBuffer streams the results of q.Watch() into "available" as
  // if available had an infinite channel buffer.