go-ptimports

command module
v2.5.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

README

go-ptimports

go-ptimports is a formatter for Go code. Functionally, it is almost identical to goimports. However, it provides the following extra functionality:

  • When the -s flag is specified, code is simplified in the same manner as gofmt -s

For example, a range statement such as:

range i, _ := arr {
    _ = i
}

becomes:

range i := arr {
    _ = i
}
  • When the -r flag is specified, any non-CGo non-block imports are converted to block imports

For example:

import "go/ast"

becomes:

import (
	"go/ast"
)

Import statements of the form import "C" (and any comments associated with such import statements) are preserved.

The output of go-ptimports is compliant with goimports and gofmt.

Runing go-ptimports without any extra flags matches the behavior of goimports. Running go-ptimports with the --format-only flag is roughly equivalent to the behavior of gofmt.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL