github.com/karrick/gorill@v1.10.3/write_test.go (about)

     1  package gorill
     2  
     3  const (
     4  	largeBufSize = 8192 // large enough to force bufio.Writer to flush
     5  	smallBufSize = 64
     6  )
     7  
     8  var (
     9  	largeBuf []byte
    10  	smallBuf []byte
    11  )
    12  
    13  func init() {
    14  	newBuf := func(size int) []byte {
    15  		buf := make([]byte, size)
    16  		for i := range buf {
    17  			buf[i] = byte(i % 256)
    18  		}
    19  		return buf
    20  	}
    21  	largeBuf = newBuf(largeBufSize)
    22  	smallBuf = newBuf(smallBufSize)
    23  }