Command uncomment removes comments from Go source files.
Installation
To install/update:
$ go install modernc.org/uncomment@latest
Verbose output
Add -v to turn on progress tracing and printing out totals.
Add -keep-godoc to keep comments of exported top level declarations.
Formatting output
Add -gofmt to format the output files.
Example
To remove non-godoc comments in a set of specific files and format the result:
uncomment -keep-godoc -gofmt lib/sqlite*.go libtest/sqlite*.go
Notes
Input files are overwritten without asking. Be sure to have a backup of your
files before using uncomment.
Package comments are not touched.
Bugs
The parser used by uncomment does not yet handle some generic constructs.