summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
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
-}