forked from bradfitz/goimports
-
Notifications
You must be signed in to change notification settings - Fork 0
Tool to fix (add, remove) your Go imports automatically.
License
shivakumargn/goimports
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This tool updates your Go import lines, adding missing ones and removing unreferenced ones. $ go get github.com/bradfitz/goimports It's a fork of gofmt, and will also format your code, so it can be used as a replacement for your gofmt-on-save hook in your editor of choice. For emacs, make sure you have the latest (Go 1.2) go-mode.el: https://go.googlecode.com/hg/misc/emacs/go-mode.el Then in your .emacs file: (setq gofmt-command "goimports") (add-to-list 'load-path "/home/you/goroot/misc/emacs/") (require 'go-mode-load) (add-hook 'before-save-hook 'gofmt-before-save) For vim, set "gofmt_command" to "goimports": https://code.google.com/p/go/source/detail?r=39c724dd7f252 https://code.google.com/p/go/source/browse#hg%2Fmisc%2Fvim etc For other editors, you probably know what to do. Happy hacking! Caveats: For removal, it assumes the import path base matches the package name, which is best practice anyway, like: import "github.com/you/foo" // assumes this is package "foo" If they don't match, explicitly name the package name in your import line: import foo "github.com/you/not-quite-foo" These caveats might be fixed.
About
Tool to fix (add, remove) your Go imports automatically.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Go 100.0%