Remove leading / trailing blank lines in Go functions, structs, if, switches, blocks.
MIT License
Remove leading / trailing blank lines in Go functions, structs, if, switches, blocks.
go install github.com/Eun/goremovelines/cmd/goremovelines@latest
usage: goremovelines [<flags>] [<path>...]
Remove leading / trailing blank lines in Go functions, structs, if, switches, blocks.
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
-r, --remove=func|struct|if|switch|case|for|interface|block ...
Remove blank lines for the context (specify it multiple times, e.g.: --remove=func --remove=struct)
-w, --toSource Write result to (source) file instead of stdout
-s, --skip=DIR... ... Skip directories with this name when expanding '...'.
--vendor Enable vendoring support (skips 'vendor' directories and sets GO15VENDOREXPERIMENT=1).
-d, --debug Display debug messages.
-v, --version Show application version.
Args:
[<path>] Directories to format. Defaults to ".". <path>/... will recurse.
It is possible to combine it with gofmt/goimport/goreturns using gomultifmt
package main
import "fmt"
func main() {
fmt.Print("Hello")
fmt.Print("World")
}
will be transformed to
package main
import "fmt"
func main() {
fmt.Print("Hello")
fmt.Print("World")
}