• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..16-Feb-2021-

golint/H16-Feb-2021-6851

misc/H16-Feb-2021-8445

testdata/H16-Feb-2021-534283

LICENSEH A D16-Feb-20211.4 KiB2824

READMEH A D16-Feb-20212.3 KiB6044

lint.goH A D16-Feb-202127.7 KiB1,058851

lint_test.goH A D16-Feb-20214.8 KiB198172

README

1Golint is a linter for Go source code.
2
3To install, run
4  go get github.com/golang/lint/golint
5
6Invoke golint with one or more filenames or directories.
7The output of this tool is a list of suggestions in Vim quickfix format,
8which is accepted by lots of different editors.
9
10Golint differs from gofmt. Gofmt reformats Go source code, whereas
11golint prints out style mistakes.
12
13Golint differs from govet. Govet is concerned with correctness, whereas
14golint is concerned with coding style. Golint is in use at Google, and it
15seeks to match the accepted style of the open source Go project.
16
17The suggestions made by golint are exactly that: suggestions.
18Golint is not perfect, and has both false positives and false negatives.
19Do not treat its output as a gold standard. We will not be adding pragmas
20or other knobs to suppress specific warnings, so do not expect or require
21code to be completely "lint-free".
22In short, this tool is not, and will never be, trustworthy enough for its
23suggestions to be enforced automatically, for example as part of a build process.
24
25If you find an established style that is frequently violated, and which
26you think golint could statically check, file an issue at
27  https://github.com/golang/lint/issues
28
29
30Contributions
31-------------
32Contributions to this project are welcome, though please send mail before
33starting work on anything major. Contributors retain their copyright, so we
34need you to fill out a short form before we can accept your contribution:
35  https://developers.google.com/open-source/cla/individual
36
37
38Vim
39---
40Add this to your ~/.vimrc:
41  set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
42If you have multiple entries in your GOPATH, replace $GOPATH with the right value.
43
44Running :Lint will run golint on the current file and populate the quickfix list.
45
46Optionally, add this to your ~/.vimrc to automatically run golint on :w
47  autocmd BufWritePost,FileWritePost *.go execute 'Lint' | cwindow
48
49
50Emacs
51-----
52Add this to your .emacs file:
53  (add-to-list 'load-path (concat (getenv "GOPATH")  "/src/github.com/golang/lint/misc/emacs"))
54  (require 'golint)
55If you have multiple entries in your GOPATH, replace $GOPATH with the right value.
56
57Running M-x golint will run golint on the current file.
58For more usage, see Compilation-Mode:
59  http://www.gnu.org/software/emacs/manual/html_node/emacs/Compilation-Mode.html
60