GoPLS Viewer

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