(size int)
| 710 | var bufPool = make(chan []byte, 20) |
| 711 | |
| 712 | func getBuf(size int) []byte { |
| 713 | for { |
| 714 | select { |
| 715 | case b := <-bufPool: |
| 716 | if cap(b) >= size { |
| 717 | return b[:size] |
| 718 | } |
| 719 | default: |
| 720 | return make([]byte, size) |
| 721 | } |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | func putBuf(b []byte) { |
| 726 | select { |
no outgoing calls
no test coverage detected