Created
July 12, 2018 00:54
-
-
Save raecoo/4eab26f01a5e4fd3f03837b2e7cc97d3 to your computer and use it in GitHub Desktop.
Msgpack serialization the []byte data by Go-lang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b := []byte{'g', 'o', 'o', 'g', 'l', 'e'} | |
s := string(b) | |
var mp interface{} | |
packedMp, _ := msgpack.Marshal(s) | |
msgpack.Unmarshal(packedMp, &mp) | |
println(b, s, packedMp, mp.(string)) | |
#-> [6/6]0xc42014bf22 google [7/64]0xc42015b758 google |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment