diff options
| author | Jeff Carr <[email protected]> | 2025-10-08 10:42:18 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-08 10:42:18 -0500 |
| commit | 6feac2ad08250625fd29951b5769655f683b3d03 (patch) | |
| tree | 59ba4fdea6700be080700aedd7c6678835ffec19 /protoReformat.go | |
| parent | 0c313d9cc066af084b93b28e1320b502d93dbda6 (diff) | |
Diffstat (limited to 'protoReformat.go')
| -rw-r--r-- | protoReformat.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/protoReformat.go b/protoReformat.go index 8b49879..77cc723 100644 --- a/protoReformat.go +++ b/protoReformat.go @@ -8,6 +8,7 @@ import ( "iter" "os" "regexp" + "strconv" "strings" sync "sync" @@ -565,6 +566,23 @@ func (msg *FormatMsg) formatVarLine(line string, dbg string) string { vartype, varname, id, end := tokenMsgVar(line) end = strings.TrimSpace(end) + + if argv.Renumber { + // allows auto-renumbering + newint, err := strconv.Atoi(id) + if err != nil { + log.Info("i is wrong", msg, err) + panic("what?") + } + msg.Counter += 1 + if int(msg.Counter) != newint { + // panic("you can't count") + log.Info("counter is wrong", newint, id, msg.Header) + } + id = fmt.Sprintf("%d", msg.Counter) + } + // log.Info("counter =", newint, msg.Header) + // msg.Counter = int32(newint) id = id + ";" newline := fmt.Sprintf(hmm, vartype, varname, id, end) |
