github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/golang/lint/README.md (about) 1 Golint is a linter for Go source code. 2 3 [](https://travis-ci.org/golang/lint) 4 5 ## Installation 6 7 go get -u github.com/golang/lint/golint 8 9 ## Usage 10 11 Invoke `golint` with one or more filenames, a directory, or a package named 12 by its import path. Golint uses the same 13 [import path syntax](https://golang.org/cmd/go/#hdr-Import_path_syntax) as 14 the `go` command and therefore 15 also supports relative import paths like `./...`. Additionally the `...` 16 wildcard can be used as suffix on relative and absolute file paths to recurse 17 into them. 18 19 The output of this tool is a list of suggestions in Vim quickfix format, 20 which is accepted by lots of different editors. 21 22 ## Purpose 23 24 Golint differs from gofmt. Gofmt reformats Go source code, whereas 25 golint prints out style mistakes. 26 27 Golint differs from govet. Govet is concerned with correctness, whereas 28 golint is concerned with coding style. Golint is in use at Google, and it 29 seeks to match the accepted style of the open source Go project. 30 31 The suggestions made by golint are exactly that: suggestions. 32 Golint is not perfect, and has both false positives and false negatives. 33 Do not treat its output as a gold standard. We will not be adding pragmas 34 or other knobs to suppress specific warnings, so do not expect or require 35 code to be completely "lint-free". 36 In short, this tool is not, and will never be, trustworthy enough for its 37 suggestions to be enforced automatically, for example as part of a build process. 38 Golint makes suggestions for many of the mechanically checkable items listed in 39 [Effective Go](https://golang.org/doc/effective_go.html) and the 40 [CodeReviewComments wiki page](https://golang.org/wiki/CodeReviewComments). 41 42 If you find an established style that is frequently violated, and which 43 you think golint could statically check, 44 [file an issue](https://github.com/golang/lint/issues). 45 46 ## Contributions 47 48 Contributions to this project are welcome, though please send mail before 49 starting work on anything major. Contributors retain their copyright, so we 50 need you to fill out 51 [a short form](https://developers.google.com/open-source/cla/individual) 52 before we can accept your contribution. 53 54 ## Vim 55 56 Add this to your ~/.vimrc: 57 58 set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim 59 60 If you have multiple entries in your GOPATH, replace `$GOPATH` with the right value. 61 62 Running `:Lint` will run golint on the current file and populate the quickfix list. 63 64 Optionally, add this to your `~/.vimrc` to automatically run `golint` on `:w` 65 66 autocmd BufWritePost,FileWritePost *.go execute 'Lint' | cwindow 67 68 69 ## Emacs 70 71 Add this to your `.emacs` file: 72 73 (add-to-list 'load-path (concat (getenv "GOPATH") "/src/github.com/golang/lint/misc/emacs")) 74 (require 'golint) 75 76 If you have multiple entries in your GOPATH, replace `$GOPATH` with the right value. 77 78 Running M-x golint will run golint on the current file. 79 80 For more usage, see [Compilation-Mode](http://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html).