Using sync.Pool structure we can pool objects and reuse them.
package main
import (
"bytes"
"fmt"
"sync"
)
var pool = sync.Pool{
// New creates an object when the pool has nothing available to return.
// New must return an interface{} to...