From b82e6b44dd7fa0522fa124314aa5a48d067c2976 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 8 Oct 2025 11:18:56 -0500 Subject: jeez --- filetype.proto | 13 +++++++------ identify.go | 12 +++++++++--- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/filetype.proto b/filetype.proto index 7ec6006..b18e069 100644 --- a/filetype.proto +++ b/filetype.proto @@ -2,6 +2,13 @@ syntax = "proto3"; package filepb; +// this generic message is used by autogen to identify and +// then dump the uuid and version from any arbitrary .pb file +message Identify { // `autogenpb:marshal` + string uuid = 1; // + string version = 2; // +} + message Filetype { // `autogenpb:var:w io.Writer` bool nothing = 1; // generate autosave functions (in marshal.go ?) } @@ -17,9 +24,3 @@ message Filetypes { // `autogenpb:marshal` string version = 2; // `autogenpb:version:v0.0.1` repeated Filetype Filetypes = 3; // an array of each .proto file in the working directory } -// this generic message is used by autogen to identify and -// then dump the uuid and version from any arbitrary .pb file -message Identify { // `autogenpb:marshal` - string uuid = 1; // - string version = 2; // -} diff --git a/identify.go b/identify.go index 60ea616..52f144f 100644 --- a/identify.go +++ b/identify.go @@ -1,18 +1,24 @@ package filepb +import ( + "os" + + "go.wit.com/log" +) + // 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 + return "", "", err } var pb *Identify pb = new(Identify) if err := pb.Unmarshal(data); err != nil { - return "Unmarshal(data)", err + return "", "", err } log.Info("Identify protobuf file uuid =", pb.Uuid, "version =", pb.Version) - return pb.uuid, pb.Version, nil + return pb.Uuid, pb.Version, nil } -- cgit v1.2.3