diff options
Diffstat (limited to 'weed/filer/filer_conf.go')
| -rw-r--r-- | weed/filer/filer_conf.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/weed/filer/filer_conf.go b/weed/filer/filer_conf.go index 59abaa5ab..30161cfaf 100644 --- a/weed/filer/filer_conf.go +++ b/weed/filer/filer_conf.go @@ -13,7 +13,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" "github.com/seaweedfs/seaweedfs/weed/util" "github.com/viant/ptrie" - "google.golang.org/protobuf/jsonpb" + jsonpb "google.golang.org/protobuf/encoding/protojson" ) const ( @@ -93,7 +93,7 @@ func (fc *FilerConf) loadFromChunks(filer *Filer, content []byte, chunks []*file func (fc *FilerConf) LoadFromBytes(data []byte) (err error) { conf := &filer_pb.FilerConf{} - if err := jsonpb.Unmarshal(bytes.NewReader(data), conf); err != nil { + if err := jsonpb.Unmarshal(data, conf); err != nil { return err } @@ -181,11 +181,5 @@ func (fc *FilerConf) ToProto() *filer_pb.FilerConf { } func (fc *FilerConf) ToText(writer io.Writer) error { - - m := jsonpb.Marshaler{ - EmitDefaults: false, - Indent: " ", - } - - return m.Marshal(writer, fc.ToProto()) + return ProtoToText(writer, fc.ToProto()) } |
