code: func (bg *Writer) Write(b []byte) (int, error) {
  	if bg.closed {
  		return 0, ErrClosed
  	}
  	err := bg.Error()
  	if err != nil {
  		return 0, err
  	}
  
  	c := bg.active
  	var n int
  	for ; len(b) > 0 && err == nil; err = bg.Error() {
  		var _n int
  		if c.next == 0 || c.next+len(b) <= len(c.block) {
  			_n = copy(c.block[c.next:], b)
  			b = b[_n:]
  			c.next += _n
  			n += _n
  		}
  
  		if c.next == len(c.block) || _n == 0 {
  			bg.queue <- c
  			bg.qwg.Add(1)
  			go c.writeBlock()
  			c = <-bg.waiting
  		}
  	}
  	bg.active = c
  
  	return n, bg.Error()
  }
docs: // Write writes the compressed form of b to the underlying io.Writer.
  // Decompressed data blocks are limited to BlockSize, so individual
  // byte slices may span block boundaries, however the Writer attempts
  // to keep each write within a single data block.