如何按字节大小比较文本的原始版本和压缩版本

I have a snippet of code that is gzipped a string, it then reads the compressed version back to the original.

How can I measure the level of compression? i.e. count the bytes of the string before and after?

    sentence := "A long time ago in a galaxy far, far away..."

    var buf bytes.Buffer
    zw := gzip.NewWriter(&buf)

    // Setting the Header fields is optional.
    zw.Name = "a-new-hope.txt"
    zw.Comment = "an epic space opera by George Lucas"
    zw.ModTime = time.Date(1977, time.May, 25, 0, 0, 0, 0, time.UTC)

    _, err := zw.Write([]byte(sentence))
    if err != nil {
        log.Fatal(err)
    }

    if err := zw.Close(); err != nil {
        log.Fatal(err)
    }

I have this code in go playground https://play.golang.org/p/9T2BOpCFmar

Before size :

fmt.Println(len(sentence))

After size :

fmt.Println(buf.Len())

Be sure to call buf.Len() before closing the writer