diff options
| author | Jeff Carr <[email protected]> | 2025-10-10 15:33:47 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-10 15:33:47 -0500 |
| commit | 67809c6d898489b65573c6dfb4059aeef3258e69 (patch) | |
| tree | 7a779c848f95ea628f80d7277cbf2e6ddf37470a | |
| parent | 61474b6448fa0da0c30514fa3300513f22ae003e (diff) | |
moved to config
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | argv.go | 2 | ||||
| -rw-r--r-- | main.go | 27 |
3 files changed, 11 insertions, 20 deletions
@@ -89,7 +89,7 @@ deb: forge normal deb-forcedirty: - wit build deb --verbose --force --all + wit build deb --verbose --force forge normal deb-all: @@ -48,7 +48,7 @@ type BuildCmd struct { } type ProtoCmd struct { - Indentify string `arg:"--identify" help:"identify a .pb file"` + Identify string `arg:"--identify" help:"identify a .pb file"` } type LinuxCmd struct { @@ -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 -} |
