aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_fs_meta_cat.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-08-17 12:42:03 -0700
committerchrislu <chris.lu@gmail.com>2022-08-17 12:42:03 -0700
commit2b580a7566536fb229a50af94b67d9df46724f34 (patch)
tree73bd8091568909116fbb83cb1c5400c9ee004333 /weed/shell/command_fs_meta_cat.go
parenteaeb141b09326aa7c4d1d1e7b7f27e119d019f9c (diff)
downloadseaweedfs-2b580a7566536fb229a50af94b67d9df46724f34.tar.xz
seaweedfs-2b580a7566536fb229a50af94b67d9df46724f34.zip
also migrate jsonpb
Diffstat (limited to 'weed/shell/command_fs_meta_cat.go')
-rw-r--r--weed/shell/command_fs_meta_cat.go20
1 files changed, 2 insertions, 18 deletions
diff --git a/weed/shell/command_fs_meta_cat.go b/weed/shell/command_fs_meta_cat.go
index 4f3b3551e..3ae106415 100644
--- a/weed/shell/command_fs_meta_cat.go
+++ b/weed/shell/command_fs_meta_cat.go
@@ -2,8 +2,7 @@ package shell
import (
"fmt"
- "golang.org/x/exp/slices"
- "google.golang.org/protobuf/jsonpb"
+ "github.com/seaweedfs/seaweedfs/weed/filer"
"google.golang.org/protobuf/proto"
"io"
@@ -50,22 +49,7 @@ func (c *commandFsMetaCat) Do(args []string, commandEnv *CommandEnv, writer io.W
return err
}
- m := jsonpb.Marshaler{
- EmitDefaults: true,
- Indent: " ",
- }
- slices.SortFunc(respLookupEntry.Entry.Chunks, func(a, b *filer_pb.FileChunk) bool {
- if a.Offset == b.Offset {
- return a.Mtime < b.Mtime
- }
- return a.Offset < b.Offset
- })
- text, marshalErr := m.MarshalToString(respLookupEntry.Entry)
- if marshalErr != nil {
- return fmt.Errorf("marshal meta: %v", marshalErr)
- }
-
- fmt.Fprintf(writer, "%s\n", text)
+ filer.ProtoToText(writer, respLookupEntry.Entry)
bytes, _ := proto.Marshal(respLookupEntry.Entry)
gzippedBytes, _ := util.GzipData(bytes)