From c564f47b92b7000afcd9b0ee668a2b6f2a6e4376 Mon Sep 17 00:00:00 2001 From: livio-a Date: Mon, 30 Mar 2020 16:53:29 +0200 Subject: [PATCH] single marshaller --- internal/proto/struct.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/proto/struct.go b/internal/proto/struct.go index f1b5eb29f..5c7b93b43 100644 --- a/internal/proto/struct.go +++ b/internal/proto/struct.go @@ -10,6 +10,10 @@ import ( "github.com/caos/logging" ) +var ( + marshaller = new(jsonpb.Marshaler) +) + func MustToPBStruct(object interface{}) *pb_struct.Struct { s, err := ToPBStruct(object) logging.Log("PROTO-7Aa3t").OnError(err).Panic("unable to map object to pb-struct") @@ -38,7 +42,6 @@ func MustFromPBStruct(object interface{}, s *pb_struct.Struct) { } func FromPBStruct(object interface{}, s *pb_struct.Struct) error { - marshaller := new(jsonpb.Marshaler) jsonString, err := marshaller.MarshalToString(s) if err != nil { return err