goimports-reviser

command module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 8 Imported by: 0

README

goimports-reviser Tweet

'Status Badge' 'Release Badge' 'Quality Badge' codecov GitHub All Releases GitHub release (latest by date) goimports-reviser license

'logo'

Tool for Golang to sort goimports by 3 groups: std, general and project dependencies. Also, formatting for your code will be prepared(so, you don't need to use gofmt or goimports separately). Use additional option -rm-unused to remove unused imports and -set-alias to rewrite import aliases for versioned packages.

Install

With Brew
brew tap incu6us/homebrew-tap
brew install incu6us/homebrew-tap/goimports-reviser
With Snap
snap install goimports-reviser

How To Use

'How To'

Before usage:

package testdata

import (
	"log"

	"github.com/incu6us/goimports-reviser/testdata/innderpkg"

	"bytes"

	"github.com/pkg/errors"
)

After usage:

package testdata

import (
	"bytes"
	"log"
	
	"github.com/pkg/errors"
	
	"github.com/incu6us/goimports-reviser/testdata/innderpkg"
)

Comments(not Docs) for imports is acceptable. Example:

package testdata

import (
    "fmt" // comments to the package here
)
Options:
  -file-path string
    	File path to fix imports(ex.: ./reviser/reviser.go). Required parameter.
  -project-name string
    	Your project name(ex.: github.com/incu6us/goimports-reviser). Required parameter.
  -rm-unused
    	Remove unused imports. Optional parameter.
  -set-alias
        Set alias for versioned package names, like 'github.com/go-pg/pg/v9'. 
        In this case import will be set as 'pg "github.com/go-pg/pg/v9"'. Optional parameter.
  -version
    	Show version.

Examples:

Cmd
goimports-reviser -project-name github.com/incu6us/goimports-reviser -file-path ./reviser/reviser.go -rm-unused -set-alias
Example, to configure it with JetBrains IDEs (via file watcher plugin):

example

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
std

Jump to

Keyboard shortcuts

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