summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protoReformat.go29
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)
}