A tool for speedup goimports command 🐉
Go
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd/dragon-imports
.travis.yml
LICENSE
README.md
dir.go
dragon.go
file_info.go
gopath_libs.go
install.go
out.go
out_test.go
std_libs.go
walk.go

README.md

dragon-imports Build Status

A tool for speedup goimports command 🐉

Usage

All you have to do run dragon-imports command 👍

$ dragon-imports

After run the command, your goimports will become fast 💫

goimports time (sec)

before after
0.893 0.019

How dose it work?

goimports command searches for a package with the given symbols from stdlib mappings at first. In this case, the command hopefully never have to scan the GOPATH.

dragon-imports add GOPATH's libs to stdlib mappings, and install goimports again.

new goimports have stdlib and all GOPATH's libs mappings, it's very fast.

Return to the original goimports

You can return to the original goimports by the following:

$ cd $GOPATH/src/golang.org/x/tools
$ git checkout imports/zstdlib.go
$ cd $GOPATH/src/golang.org/x/tools/cmd/goimports
$ go install -a .

Installation

$ go get github.com/monochromegane/dragon-imports/...

ToDo

  • File system notification.
  • Ignore option.

Contribution

  1. Fork it
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create new Pull Request

License

MIT

Author

monochromegane