summaryrefslogtreecommitdiff
path: root/identify.go
diff options
context:
space:
mode:
Diffstat (limited to 'identify.go')
-rw-r--r--identify.go18
1 files changed, 18 insertions, 0 deletions
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
+}