package main
import (
"github.com/golang/protobuf/ptypes/any"
"github.com/gogo/protobuf/proto"
"github.com/davecgh/go-spew/spew"
"fmt"
)
func main() {
ws := new(WebSocketMessage)
v := make(map[string]*any.Any)
a := new(any.Any)
a.Value = []byte("ddd")
v["a"] = a
v["b"] = a
ws.Value = v
dd, _ := proto.Marshal(ws)
ws2 := new(WebSocketMessage)
proto.Unmarshal(dd, ws2)
spew.Dump(ws2)
fmt.Printf(" %s", ws2.GetValue())
}
网友评论