Eun / goremovelines

Remove leading / trailing blank lines in Go functions, structs, if, switches, blocks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

goremovelines

Actions Status Coverage Status PkgGoDev go-report

Remove leading / trailing blank lines in Go functions, structs, if, switches, blocks.

Installation

go install github.com/Eun/goremovelines/cmd/goremovelines@latest

Usage

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")
}

Build History

Build history

About

Remove leading / trailing blank lines in Go functions, structs, if, switches, blocks.

License:MIT License


Languages

Language:Go 100.0%