cluster_packet_test.go 397 B

1234567891011121314151617181920212223242526
  1. package mhayaProto
  2. import (
  3. "fmt"
  4. "testing"
  5. "google.golang.org/protobuf/proto"
  6. )
  7. func TestMarshal(t *testing.T) {
  8. req1 := &ClusterPacket{
  9. SourcePath: "",
  10. TargetPath: "",
  11. FuncName: "",
  12. ArgBytes: nil,
  13. Session: nil,
  14. }
  15. bytes, err := proto.Marshal(req1)
  16. fmt.Println(err)
  17. fmt.Println(len(bytes))
  18. req2 := &ClusterPacket{}
  19. proto.Unmarshal(bytes, req2)
  20. fmt.Println(req2)
  21. }