text, _ := ioutil.ReadFile("file.exe")
var compr bytes.Buffer
writer, err := gzip.NewWriterLevel(&compr, gzip.BestCompression)
_, err = writer.Write(text)
writer.Close()
if err != nil {
return []byte(""), err
}
ioutil.WriteFile("file1.exe", compr.Bytes(), os.ModePerm)