diff options
| author | Jeff Carr <[email protected]> | 2025-10-08 11:18:56 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-08 11:18:56 -0500 |
| commit | b82e6b44dd7fa0522fa124314aa5a48d067c2976 (patch) | |
| tree | 20350b002066fd8e40f359f5240527c63663ee28 | |
| parent | d82353457849bd574f028694e4e1e8a37b54ac4b (diff) | |
jeezv0.0.3
| -rw-r--r-- | filetype.proto | 13 | ||||
| -rw-r--r-- | 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 } |
