found mutex
This commit is contained in:
parent
40bb6caf20
commit
d850ec82c8
4
main.go
4
main.go
|
@ -133,7 +133,7 @@ func main() {
|
||||||
// parse sort & marshal options from the .proto file
|
// parse sort & marshal options from the .proto file
|
||||||
// this goes through the .proto files and looks
|
// this goes through the .proto files and looks
|
||||||
// for `autogenpb: ` lines
|
// for `autogenpb: ` lines
|
||||||
if err := findAutogenpb(sortmap); err != nil {
|
if err := pb.findAutogenpb(f); err != nil {
|
||||||
log.Info("autogenpb parse error:", err)
|
log.Info("autogenpb parse error:", err)
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ func main() {
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
pb.addMutex(f)
|
pb.addMutex(f)
|
||||||
os.Exit(0)
|
// os.Exit(0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// experiment to add a mutex to the structs.
|
// experiment to add a mutex to the structs.
|
||||||
|
|
|
@ -11,13 +11,15 @@ import (
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// this parses the .proto file and handles anything with `autogenpb: `
|
||||||
|
|
||||||
// finds autogenpb:marshal and autogenpb:unique in the .proto file
|
// finds autogenpb:marshal and autogenpb:unique in the .proto file
|
||||||
//
|
//
|
||||||
// adds fields to []marshal and []unique
|
// adds fields to []marshal and []unique
|
||||||
func findAutogenpb(names map[string]string) error {
|
func (pb *Files) findAutogenpb(f *File) error {
|
||||||
// log.Info("starting findAutogenpb() on", names["protofile"])
|
// log.Info("starting findAutogenpb() on", names["protofile"])
|
||||||
// read in the .proto file
|
// read in the .proto file
|
||||||
data, err := os.ReadFile(names["protofile"])
|
data, err := os.ReadFile(f.Filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// log.Info("open config file :", err)
|
// log.Info("open config file :", err)
|
||||||
return err
|
return err
|
||||||
|
@ -39,6 +41,14 @@ func findAutogenpb(names map[string]string) error {
|
||||||
// log.Info("found unique field", newu)
|
// log.Info("found unique field", newu)
|
||||||
uniqueKeys = append(uniqueKeys, newu)
|
uniqueKeys = append(uniqueKeys, newu)
|
||||||
}
|
}
|
||||||
|
if strings.Contains(line, "autogenpb:mutex") {
|
||||||
|
parts := strings.Split(line, "autogenpb:mutex")
|
||||||
|
// log.Info("FOUND MUTEX line:", parts[0])
|
||||||
|
fields := strings.Fields(parts[0])
|
||||||
|
if fields[0] == "message" {
|
||||||
|
log.Info("FOUND MUTEX:", fields[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue