summaryrefslogtreecommitdiff
path: root/protoc.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-30 12:44:04 -0600
committerJeff Carr <[email protected]>2024-11-30 12:44:04 -0600
commitd24d8368993da167be40d6276956f378120af18b (patch)
treed7b0fee545f76550a05b04f132ee1f437a580af4 /protoc.go
parentdc356e9d0fc6b05f50b01d141206f679ecda2de9 (diff)
have to auto run protoc
Diffstat (limited to 'protoc.go')
-rw-r--r--protoc.go61
1 files changed, 35 insertions, 26 deletions
diff --git a/protoc.go b/protoc.go
index f3b545d..b67effa 100644
--- a/protoc.go
+++ b/protoc.go
@@ -5,6 +5,7 @@ package main
import (
"errors"
"os"
+ "strings"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
@@ -34,35 +35,43 @@ func protocBuild(names map[string]string) error {
}
log.Info("make protoc file:", names["protoc"])
log.Info("go src", forge.GetGoSrc())
+ pwd, _ := os.Getwd()
+ log.Info("go.Getwd()", pwd)
+ if ! strings.HasPrefix(pwd, forge.GetGoSrc()) {
+ return errors.New("paths don't match")
+ }
+ gopath := strings.TrimPrefix(pwd, forge.GetGoSrc())
+ log.Info("gopath", gopath)
return errors.New("make protoc here")
}
- /*
- data, err := os.ReadFile(fullname)
- if err != nil {
- // log.Info("open config file :", err)
- return err
- }
- w, _ := os.OpenFile(names["protobase"]+".pb.go", os.O_WRONLY|os.O_CREATE, 0600)
+/*
+ data, err := os.ReadFile(fullname)
+ if err != nil {
+ // log.Info("open config file :", err)
+ return err
+ }
- var found bool
+ w, _ := os.OpenFile(names["protobase"]+".pb.go", os.O_WRONLY|os.O_CREATE, 0600)
- lines := strings.Split(string(data), "\n")
- for _, line := range lines {
- // log.Info("line:", line)
- start := "type " + names["Bases"] + " struct {"
- if strings.HasSuffix(line, start) {
- found = true
- log.Info("FOUND line:", line)
- fmt.Fprintln(w, line)
- fmt.Fprintln(w, "\tsync.RWMutex // auto-added by go.wit.com/apps/autogenpb")
- fmt.Fprintln(w, "")
- } else {
- fmt.Fprintln(w, line)
- }
- }
- // os.Exit(-1)
- if found {
- return nil
+ var found bool
+
+ lines := strings.Split(string(data), "\n")
+ for _, line := range lines {
+ // log.Info("line:", line)
+ start := "type " + names["Bases"] + " struct {"
+ if strings.HasSuffix(line, start) {
+ found = true
+ log.Info("FOUND line:", line)
+ fmt.Fprintln(w, line)
+ fmt.Fprintln(w, "\tsync.RWMutex // auto-added by go.wit.com/apps/autogenpb")
+ fmt.Fprintln(w, "")
+ } else {
+ fmt.Fprintln(w, line)
}
- */
+ }
+ // os.Exit(-1)
+ if found {
+ return nil
+ }
+*/