cleanup output more

This commit is contained in:
Jeff Carr 2025-01-09 04:03:30 -06:00
parent 6f354d8d9f
commit d67c2eb3a2
2 changed files with 11 additions and 11 deletions

12
main.go
View File

@ -71,16 +71,20 @@ func main() {
log.Info("pwd = ", pwd) log.Info("pwd = ", pwd)
if !shell.Exists("go.sum") { if !shell.Exists("go.sum") {
shell.RunQuiet([]string{"go", "mod", "init"}) shell.RunQuiet([]string{"go-mod-clean"})
shell.RunQuiet([]string{"go", "mod", "tidy"}) if !shell.Exists("go.sum") {
shell.RunQuiet([]string{"go", "mod", "edit", "-go=1.18"}) // TODO: pass this as ENV. verify protobuf version needed shell.RunQuiet([]string{"go", "mod", "init"})
shell.RunQuiet([]string{"go", "mod", "tidy"})
shell.RunQuiet([]string{"go", "mod", "edit", "-go=1.18"}) // TODO: pass this as ENV. verify protobuf version needed
}
} }
var packageName string var packageName string
var result cmd.Status var result cmd.Status
var cmd []string var cmd []string
if argv.Package == "" { if argv.Package == "" {
// TODO: switch to using forgepb // TODO: switch to using forgepb (expose the functions/logic from forgepb directly
// it could be a bad idea to use forge.Init() here as forge needs this to build
// switch to forgepb // switch to forgepb
os.Setenv("GO111MODULE", "off") // keeps go list working if go version is back versioned for compatability os.Setenv("GO111MODULE", "off") // keeps go list working if go version is back versioned for compatability
cmd = []string{"go", "list", "-f", "'{{.Name}}'"} cmd = []string{"go", "list", "-f", "'{{.Name}}'"}

View File

@ -44,8 +44,6 @@ func (pb *Files) findAutogenpb(f *File) error {
newm := parts[1] newm := parts[1]
if curmsg == nil { if curmsg == nil {
log.Info("Error: Found Sort for:", newm, "however, this struct can't be used") log.Info("Error: Found Sort for:", newm, "however, this struct can't be used")
// log.Info("found marshal", newm)
marshalKeys = append(marshalKeys, newm)
} else { } else {
log.Info("Found Sort for:", newm, "in struct", curmsg.Name) log.Info("Found Sort for:", newm, "in struct", curmsg.Name)
} }
@ -56,11 +54,9 @@ func (pb *Files) findAutogenpb(f *File) error {
} }
if strings.Contains(line, "autogenpb:unique") { if strings.Contains(line, "autogenpb:unique") {
if parts[0] == "repeated" { if parts[0] == "repeated" {
// log.Info("Found Unique for:", parts)
newu := parts[1] newu := parts[1]
newu = cases.Title(language.English, cases.NoLower).String(newu) newu = cases.Title(language.English, cases.NoLower).String(newu)
log.Info("found unique field", newu, "in struct", curmsg.Name) log.Info("Found unique field", newu, "in struct", curmsg.Name)
// uniqueKeys = append(uniqueKeys, newu)
} else { } else {
log.Info("Error:", line) log.Info("Error:", line)
log.Info("Error: can not append on non repeated fields") log.Info("Error: can not append on non repeated fields")
@ -83,11 +79,11 @@ func (f *File) parseForMessage(line string) *MsgName {
if strings.Contains(line, "`autogenpb:mutex`") { if strings.Contains(line, "`autogenpb:mutex`") {
msg.DoMutex = true msg.DoMutex = true
log.Info("Found Mutex for:", msg.Name) log.Info("Added Mutex=true:", msg.Name)
} }
if strings.Contains(line, "`autogenpb:marshal`") { if strings.Contains(line, "`autogenpb:marshal`") {
msg.DoMarshal = true msg.DoMarshal = true
log.Info("Found Marshal for:", msg.Name) log.Info("Added Marshal=true:", msg.Name)
} }
return msg return msg
} }