Recently, I needed to strip all debug log statements from a code base. Since I use the same general
pattern for debug statements, e.g, DEBUG:, it is easily accomplished with the following shell command:
rg -l "^.*DEBUG:.*\$" --glob '!vendor/' -t go | xargs -r sd '.*DEBUG:.*\n' ''
The only this the is ‘one-liner’ does not cover is removing the imports from the file. Additionally, any log statements that split lines will need some clean-up.
