code: func readBuffer(copyTo chan<- []byte, socketRead io.ReadCloser, batchSize int, workSize int) {
  	defer close(copyTo)
  	for {
  		batch := make([]byte, batchSize)
  		size, err := socketRead.Read(batch)
  		if err == nil && workSize != 0 && size%workSize != 0 {
  			var lsize int
  			lsize, err = io.ReadFull(
  				socketRead,
  				batch[size:size+workSize-(size%workSize)])
  			size += lsize
  		}
  		if size > 0 {
  			if err != nil && workSize != 0 {
  				size -= (size % workSize)
  			}
  			copyTo <- batch[:size]
  		}
  		if err != nil {
  			if err != io.EOF {
  				log.Print("Error encountered in readBuffer:", err)
  			}
  			return
  		}
  	}
  }
docs: // this reads in a loop from socketRead putting batchSize bytes of work to copyTo until
  // the socketRead is empty. Will always block until a full workSize of units have been copied