summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-08 11:15:10 -0500
committerJeff Carr <[email protected]>2025-10-08 11:15:10 -0500
commitd82353457849bd574f028694e4e1e8a37b54ac4b (patch)
tree7d803bc2ac6035ac61712b9299f97678c5f0fc7d
parent5b8429cffc7eaaa8f1f026fb9c627cf96a357960 (diff)
IdentifyPB()
-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
+}