func (g *GzipCompression) Zip(plain []byte) ([]byte, error) {
	var b bytes.Buffer
	gz := gzip.NewWriter(&b)
	if _, err := gz.Write(plain); err != nil {
		return nil, err
	}
	if err := gz.Close(); err != nil {
		return nil, err
	}
	return b.Bytes(), nil
}
Zip the given byte array
package broker
import (
	"bytes"
	"compress/gzip"
	"io/ioutil"
)
type ZipCompression interface {
	Zip(plain []byte) ([]byte, error)
	Unzip(zipped []byte) ([]byte, error)
}
type GzipCompression struct{}