summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/main.go b/main.go
index 81963b6..8feef5a 100644
--- a/main.go
+++ b/main.go
@@ -125,22 +125,23 @@ func main() {
// this is helpful because the protoc-gen-go lines
// are also annoying to code by hand
- pbfile := f.Filebase + ".pb.go"
+ f.Pbfilename = f.Filebase + ".pb.go"
// try to create the foo.pb.go file using protoc if it is not there
- if !shell.Exists(pbfile) {
- if err := pb.protocBuild(f, pbfile); err != nil {
- log.Info("protoc build error:", err)
- os.Exit(-1)
+ if !shell.Exists(f.Pbfilename) {
+ if err := pb.protocBuild(f); err != nil {
+ badExit(err)
}
}
// try to add the Mutex to the pb.go file
- pb.addMutex(f)
+ if err := pb.addMutex(f); err != nil {
+ badExit(err)
+ }
// if foo.pb.go still doesn't exist, protoc failed
- if !shell.Exists(pbfile) {
- log.Info("protoc build error.", pbfile)
+ if !shell.Exists(f.Pbfilename) {
+ log.Info("protoc build error.", f.Pbfilename)
badExit(errors.New("failed to be created with protoc and proto-gen-go"))
}