diff options
| author | Jeff Carr <[email protected]> | 2025-04-02 12:33:29 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-04-02 12:33:29 -0500 |
| commit | b4df5436ec87711fd548c3106968fbcf0cdd75b4 (patch) | |
| tree | 26b7fedbc90c3737f2b3160b971bcc3a3bdd89c7 /protoReformat.go | |
| parent | 4e3e05684b642a2a70a8f6c1f00a54874b9827c1 (diff) | |
more cleanups. now to add oneof
Diffstat (limited to 'protoReformat.go')
| -rw-r--r-- | protoReformat.go | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/protoReformat.go b/protoReformat.go index d38b61e..bafdea6 100644 --- a/protoReformat.go +++ b/protoReformat.go @@ -302,32 +302,13 @@ func (msg *FormatMsg) padding(offset int) string { func formatEnum(curmsg *FormatMsg) []string { var newmsg []string - if argv.Debug { - header := fmt.Sprintf("%s%s // enum2 depth=%d", curmsg.padBase(), curmsg.Header, curmsg.Depth) - newmsg = append(newmsg, header) - /* - header = fmt.Sprintf("//%s//%s// enum2 depth=%d", curmsg.padding(2), curmsg.Header, curmsg.Depth) - newmsg = append(newmsg, header) - header = fmt.Sprintf("// %s", curmsg.Header) - newmsg = append(newmsg, header) - */ - } else { - header := fmt.Sprintf("%s%s", curmsg.padBase(), curmsg.Header) - newmsg = append(newmsg, header) - } + newmsg = append(newmsg, curmsg.formatLineBase(curmsg.Header, "enum header")) for _, line := range curmsg.Lines { - line = fmt.Sprintf("%s%s", curmsg.pad(), line) - newmsg = append(newmsg, line) + newmsg = append(newmsg, curmsg.formatLine(line, "enum")) } - if argv.Debug { - footer := fmt.Sprintf("%s%s // enum2 footer depth=%d", curmsg.padBase(), curmsg.Footer, curmsg.Depth) - newmsg = append(newmsg, footer) - } else { - footer := fmt.Sprintf("%s%s", curmsg.padBase(), curmsg.Footer) - newmsg = append(newmsg, footer) - } + newmsg = append(newmsg, curmsg.formatLineBase(curmsg.Footer, "enum header")) return newmsg } @@ -375,7 +356,7 @@ func (all *FormatMsg) format() []string { func (msg *FormatMsg) formatLineBase(line string, dbg string) string { line = strings.TrimSpace(line) if argv.Debug { - return fmt.Sprintf("%s%s // %s depth=%d", msg.padBase(), line, dbg, msg.Depth) + return fmt.Sprintf("/*a*/ %s%s // %s depth=%d", msg.padBase(), line, dbg, msg.Depth) } return fmt.Sprintf("%s%s", msg.padBase(), line) } @@ -383,7 +364,7 @@ func (msg *FormatMsg) formatLineBase(line string, dbg string) string { func (msg *FormatMsg) formatLine(line string, dbg string) string { line = strings.TrimSpace(line) if argv.Debug { - return fmt.Sprintf("%s%s // %s depth=%d", msg.pad(), line, dbg, msg.Depth) + return fmt.Sprintf("/*a*/ %s%s // %s depth=%d", msg.pad(), line, dbg, msg.Depth) } return fmt.Sprintf("%s%s", msg.padBase(), line) } |
