summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-10 15:33:47 -0500
committerJeff Carr <[email protected]>2025-10-10 15:33:47 -0500
commit67809c6d898489b65573c6dfb4059aeef3258e69 (patch)
tree7a779c848f95ea628f80d7277cbf2e6ddf37470a /main.go
parent61474b6448fa0da0c30514fa3300513f22ae003e (diff)
moved to config
Diffstat (limited to 'main.go')
-rw-r--r--main.go27
1 files changed, 9 insertions, 18 deletions
diff --git a/main.go b/main.go
index ca606c0..6266cc9 100644
--- a/main.go
+++ b/main.go
@@ -65,7 +65,15 @@ func main() {
}
if argv.PB != nil {
- s, err = doIdentifyPB("unknown.pb")
+ pbuuid, pbver, pberr := filepb.IdentifyPB(argv.PB.Identify)
+ if pberr == nil {
+ log.Info("pb version is:", pbver)
+ log.Info("pb uuid is:", pbuuid)
+ s = "pb identify worked"
+ } else {
+ s = "identify failed"
+ err = pberr
+ }
}
if argv.Clone != nil {
@@ -120,20 +128,3 @@ func trimNonNumericFromStart(s string) string {
}
return ""
}
-
-// print the protobuf in human form
-func doIdentifyPB(filename string) (string, error) {
- data, err := os.ReadFile(filename)
- if err != nil {
- // log.Info("open config file :", err)
- return "os.ReadFile()", err
- }
-
- var pb *filepb.Identify
- pb = new(filepb.Identify)
- if err := pb.Unmarshal(data); err != nil {
- return "Unmarshal(data)", err
- }
- log.Info("Identify protobuf file uuid =", pb.Uuid, "version =", pb.Version)
- return "file identify worked!", nil
-}