@@ -36,13 +36,13 @@ func Pack(m proto.Message) (pb.Envelope, error) {
3636 return pb.Envelope {}, err
3737 }
3838
39- fullName := m . ProtoReflect (). Descriptor (). FullName ()
39+ const pkg = "github.com/lykon/pletter/%s"
4040
41- fmt . Println ( fullName )
41+ fullName := m . ProtoReflect (). Descriptor (). FullName ( )
4242
4343 return pb.Envelope {
4444 InnerMessage : & anypb.Any {
45- TypeUrl : fmt .Sprintf ("github.com/lykon/pletter/%s" , fullName ),
45+ TypeUrl : fmt .Sprintf (pkg , fullName ),
4646 Value : raw ,
4747 },
4848 }, nil
@@ -56,10 +56,7 @@ func Unpack(m []byte, t proto.Message) error {
5656 return err
5757 }
5858
59- return ptypes .UnmarshalAny (
60- e .GetInnerMessage (),
61- proto_old .MessageV1 (t ),
62- )
59+ return ptypes .UnmarshalAny (e .GetInnerMessage (), proto_old .MessageV1 (t ))
6360}
6461
6562// GetMessageName returns the message name from the wrapped proto message
@@ -70,11 +67,14 @@ func GetMessageName(m []byte) (string, error) {
7067 }
7168
7269 splits := strings .Split (e .GetInnerMessage ().GetTypeUrl (), "/" )
70+
7371 return splits [len (splits )- 1 ], nil
7472}
7573
7674func getEnvelope (m []byte ) (pb.Envelope , error ) {
7775 var receivingEnvelope pb.Envelope
76+
7877 err := proto .Unmarshal (m , & receivingEnvelope )
78+
7979 return receivingEnvelope , err
8080}
0 commit comments