gopkg.in/alecthomas/gometalinter.v3@v3.0.0/_linters/src/golang.org/x/tools/cmd/goimports/doc.go (about)

     1  /*
     2  
     3  Command goimports updates your Go import lines,
     4  adding missing ones and removing unreferenced ones.
     5  
     6       $ go get golang.org/x/tools/cmd/goimports
     7  
     8  In addition to fixing imports, goimports also formats
     9  your code in the same style as gofmt so it can be used
    10  as a replacement for your editor's gofmt-on-save hook.
    11  
    12  For emacs, make sure you have the latest go-mode.el:
    13     https://github.com/dominikh/go-mode.el
    14  Then in your .emacs file:
    15     (setq gofmt-command "goimports")
    16     (add-to-list 'load-path "/home/you/somewhere/emacs/")
    17     (require 'go-mode-autoloads)
    18     (add-hook 'before-save-hook 'gofmt-before-save)
    19  
    20  For vim, set "gofmt_command" to "goimports":
    21      https://golang.org/change/39c724dd7f252
    22      https://golang.org/wiki/IDEsAndTextEditorPlugins
    23      etc
    24  
    25  For GoSublime, follow the steps described here:
    26      http://michaelwhatcott.com/gosublime-goimports/
    27  
    28  For other editors, you probably know what to do.
    29  
    30  To exclude directories in your $GOPATH from being scanned for Go
    31  files, goimports respects a configuration file at
    32  $GOPATH/src/.goimportsignore which may contain blank lines, comment
    33  lines (beginning with '#'), or lines naming a directory relative to
    34  the configuration file to ignore when scanning. No globbing or regex
    35  patterns are allowed. Use the "-v" verbose flag to verify it's
    36  working and see what goimports is doing.
    37  
    38  File bugs or feature requests at:
    39  
    40      https://golang.org/issues/new?title=x/tools/cmd/goimports:+
    41  
    42  Happy hacking!
    43  
    44  */
    45  package main // import "golang.org/x/tools/cmd/goimports"