Skip to content

Instantly share code, notes, and snippets.

@banks
Last active May 3, 2018 16:35
Show Gist options
  • Save banks/f957165227ac0dbaa3c084960613ca51 to your computer and use it in GitHub Desktop.
Save banks/f957165227ac0dbaa3c084960613ca51 to your computer and use it in GitHub Desktop.
package main
import (
"bytes"
"compress/lzw"
"crypto/md5"
"encoding/gob"
"fmt"
"log"
"time"
)
func main() {
for {
m := make(map[string]string)
m["1"] = "foo"
m["2"] = "bar"
m["3"] = "foo"
m["4"] = "bar"
m["5"] = "foo"
m["6"] = "bar"
m["7"] = "bar"
m["8"] = "bar"
m["9"] = "bar"
m["10"] = "bar"
m["21"] = "foo"
m["22"] = "bar"
m["23"] = "foo"
m["24"] = "bar"
m["25"] = "foo"
m["26"] = "bar"
m["27"] = "bar"
m["28"] = "bar"
m["29"] = "bar"
m["210"] = "bar"
m["31"] = "foo"
m["32"] = "bar"
m["33"] = "foo"
m["34"] = "bar"
m["35"] = "foo"
m["36"] = "bar"
m["37"] = "bar"
m["38"] = "bar"
m["39"] = "bar"
m["310"] = "bar"
var buf bytes.Buffer
compress := lzw.NewWriter(&buf, lzw.LSB, 8)
enc := gob.NewEncoder(compress)
if err := enc.Encode(m); err != nil {
log.Fatal(err)
}
compress.Close()
fmt.Printf("%x\n", md5.Sum(buf.Bytes()))
time.Sleep(1 * time.Second)
}
}
$ go run gob.go
3be9402e6c9f97f81619fd5b0520e1b7
4d89afed7cd9c7b1a6e6504eddebb5eb
104f1eca97526783514e09b770b767ca
a623f39288c73486cab4fe8dd23d0e49
ec952e3de087ef513357b56fc7b926ec
a2db4f5ab2880d301ac1e0ea3a227737
300807db95c272049bc158c1210a8721
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment