fork from code.google.com/p/snappy-go