diff options
| author | Jeff Carr <[email protected]> | 2025-10-30 23:15:34 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-30 23:15:34 -0500 |
| commit | 01cd36974b1f38264d2ff56b8c03c5103b78612c (patch) | |
| tree | d900e70155d18592888433b2c2e50c8c2be2871d /doProto.go | |
| parent | 8bc73bdc2d7b22ee4f21bf878bbca947f6a1b57a (diff) | |
Diffstat (limited to 'doProto.go')
| -rw-r--r-- | doProto.go | 38 |
1 files changed, 18 insertions, 20 deletions
@@ -23,7 +23,6 @@ import ( "github.com/go-cmd/cmd" "go.wit.com/lib/fhelp" "go.wit.com/lib/gui/shell" - "go.wit.com/lib/protobuf/argvpb" "go.wit.com/log" ) @@ -37,25 +36,24 @@ func doProto(argvProto string) (string, error) { if argv.Clean != nil { doClean(pf.Filebase) - argvpb.GoodExit("doClean() ran") + return "doClean() ran", nil } if argv.Mtime { doMtime(pf.Filebase) - argvpb.GoodExit("doClean() ran") + return "doClean() ran", nil } if argv.ReFormat { protoReformatComments(argvProto) // time.Sleep(5 * time.Second) protoReformat(argvProto) - log.Info("format done") - okExit("") + return "format done", nil } if argv.Comments { protoReformatComments(argvProto) - okExit("") + return "comments ok?", nil } if argv.Regret { @@ -64,7 +62,7 @@ func doProto(argvProto string) (string, error) { } if doMtime(pf.Filebase) { - argvpb.GoodExit(pf.Filename + " did not change") + return pf.Filename + " did not change", nil } else { log.Info("ctime check: need to re-run autogenpb") } @@ -74,7 +72,7 @@ func doProto(argvProto string) (string, error) { // for `autogenpb: ` lines if err := pf.protoParse(); err != nil { log.Info("autogenpb parse error:", err) - badExit(err) + return "autogenpb parse error", err } if !argv.NoFormat { @@ -82,17 +80,17 @@ func doProto(argvProto string) (string, error) { } if pf.Bases == nil { - badExit(fmt.Errorf("Base was nil. 'message %s {` did not exist", pf.Filebase)) + return "pf.Bases == nil", fmt.Errorf("Base was nil. 'message %s {` did not exist", pf.Filebase) } if pf.Base == nil { - badExit(fmt.Errorf("Base was nil. 'message %s {` did not exist", pf.Filebase)) + return "pf.Base == nil", fmt.Errorf("Base was nil. 'message %s {` did not exist", pf.Filebase) } // if you have gotten here, at least the .proto buf file is OK if argv.DryRun { // show the protobuf of the protobuf. It's like Inception pf.printMsgTable() - okExit("") + return "DryRun", nil } // todo, look for go.work files @@ -147,21 +145,21 @@ func doProto(argvProto string) (string, error) { // checkCmd("protoc-gen-go") if !fhelp.CheckProtoc() { - badExit(fmt.Errorf("you do not have 'protoc' installed")) + return "protoc missing", fmt.Errorf("you do not have 'protoc' installed") } pf.Pbfilename = pf.Filebase + ".pb.go" // try to create the foo.pb.go file using protoc if it is not there if !shell.Exists(pf.Pbfilename) { if !fhelp.CheckProtoc() { - badExit(fmt.Errorf("you do not have 'protoc' installed")) + return "protoc missing", fmt.Errorf("you do not have 'protoc' installed") } // checkCmd("protoc") // checkCmd("protoc-gen-go") if err := me.pb.protocBuild(pf); err != nil { - badExit(err) + return "protoc failed", err } } @@ -169,13 +167,13 @@ func doProto(argvProto string) (string, error) { // try to add the Mutex to the pb.go file if err := me.pb.addMutex(pf); err != nil { - badExit(err) + return "addMutex(pf) failed", err } // if foo.pb.go still doesn't exist, protoc failed if !shell.Exists(pf.Pbfilename) { - log.Info("protoc build error.", pf.Pbfilename) - badExit(errors.New("failed to be created with protoc and proto-gen-go")) + s := "protoc build error " + pf.Pbfilename + return s, errors.New("failed to be created with protoc and proto-gen-go") } // make the marshal.pb.go file @@ -183,18 +181,18 @@ func doProto(argvProto string) (string, error) { // make the sort.pb.go file if err := me.pb.makeNewSortfile(pf); err != nil { - badExit(err) + return "makeNewSortfile(pf)", err } if pf.DoGui { if err := me.pb.makeGuiFile(pf); err != nil { - badExit(err) + return "makeGuiFile(pf)", err } } if pf.DoHTTP { if err := me.pb.makeHTTPFile(pf); err != nil { - badExit(err) + return "makeHTTPFile(pf)", err } } var err error |
