diff options
| author | Jeff Carr <[email protected]> | 2025-01-12 06:28:12 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-12 06:28:12 -0600 |
| commit | 721bbd8f92d80286f12509fbbcff9f2f8e334093 (patch) | |
| tree | c7f006735b14cd1ccec5b3f7b89eed5b4d9f53ad /protoParse.go | |
| parent | 08cd2afd86557f06d6b3f6e006d686fef4c7b2ee (diff) | |
make some help on the correct messages needed
Diffstat (limited to 'protoParse.go')
| -rw-r--r-- | protoParse.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/protoParse.go b/protoParse.go index c18c87d..1e4cf79 100644 --- a/protoParse.go +++ b/protoParse.go @@ -11,6 +11,8 @@ import ( "go.wit.com/log" "golang.org/x/text/cases" "golang.org/x/text/language" + + "github.com/google/uuid" ) // this parses the .proto file and handles anything with `autogenpb: ` @@ -34,8 +36,10 @@ func (pb *Files) hasPluralMessage(f *File) error { continue } + scanner.Scan() line = scanner.Text() fields := strings.Fields(line) + // log.Info("GOT LINE", line) if fields[0] == "string" && fields[1] != "uuid" { f.noUuid() return fmt.Errorf("proto file does not have a UUID") @@ -44,8 +48,10 @@ func (pb *Files) hasPluralMessage(f *File) error { f.Uuid = line log.Info("found UUID:", line) + scanner.Scan() line = scanner.Text() fields = strings.Fields(line) + // log.Info("GOT LINE", line) if fields[0] == "string" && fields[1] != "version" { f.noUuid() return fmt.Errorf("proto file does not have a version") @@ -85,6 +91,7 @@ func (pf *File) noPluralMessage() { func (pf *File) noUuid() { base := cases.Title(language.English, cases.NoLower).String(pf.Filebase) + id := uuid.New() log.Info("") log.Info("###########################################################################") @@ -92,10 +99,10 @@ func (pf *File) noUuid() { log.Info("") log.Info("For autogenpb to work on your file", pf.Filename, ",", base+"s must be exactly:") log.Info("") - log.Info("message Fruits { // `autogenpb:marshal` `autogenpb:mutex`") - log.Info(" string uuid = 1; // `autogenpb:uuid:be926ad9-f07f-484c-adf2-d96eeabf3079`") + log.Info("message", base+"s", "{ // `autogenpb:marshal` `autogenpb:mutex`") + log.Info(" string uuid = 1; // `autogenpb:uuid:" + id.String() + "`") log.Info(" string version = 2; // `autogenpb:version:v0.0.1`") - log.Info(" repeated Fruit Fruits = 3; // THIS MUST BE ", base, " and then ", base+"s") + log.Info(" repeated", base, base+"s", " = 3; // THIS MUST BE ", base, " and then ", base+"s") log.Info("}") log.Info("") log.Info("If you don't have a UUID, you can use the randomly generated one here") |
