From d82353457849bd574f028694e4e1e8a37b54ac4b Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 8 Oct 2025 11:15:10 -0500 Subject: IdentifyPB() --- identify.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 identify.go diff --git a/identify.go b/identify.go new file mode 100644 index 0000000..60ea616 --- /dev/null +++ b/identify.go @@ -0,0 +1,18 @@ +package filepb + +// print the protobuf in human form +func IdentifyPB(filename string) (string, string, error) { + data, err := os.ReadFile(filename) + if err != nil { + // log.Info("open config file :", err) + return "os.ReadFile()", err + } + + var pb *Identify + pb = new(Identify) + if err := pb.Unmarshal(data); err != nil { + return "Unmarshal(data)", err + } + log.Info("Identify protobuf file uuid =", pb.Uuid, "version =", pb.Version) + return pb.uuid, pb.Version, nil +} -- cgit v1.2.3