commit | 818c5a80406779e3ce2860365fc289de6d133b00 | [log] [tgz] |
---|---|---|
author | Ian Lance Taylor <iant@golang.org> | Tue Nov 05 11:32:50 2024 -0800 |
committer | Gopher Robot <gobot@golang.org> | Tue Nov 12 19:41:09 2024 +0000 |
tree | 3c7d4c1c017f34740b632c3716e5c880b05faf71 | |
parent | 6edffad5e6160f5949cdefc81710b2706fbcd4f6 [diff] |
README: remove Contributions section The repo is frozen and we are not taking contributions. Change-Id: I6a2e930427fc03f6c80f3b795bbd77322e1df42e Reviewed-on: https://go-review.googlesource.com/c/lint/+/625735 Commit-Queue: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
NOTE: Golint is deprecated and frozen. There's no drop-in replacement for it, but tools such as Staticcheck and go vet
should be used instead.
Golint is a linter for Go source code.
Golint requires a supported release of Go.
go get -u golang.org/x/lint/golint
To find out where golint
was installed you can run go list -f {{.Target}} golang.org/x/lint/golint
. For golint
to be used globally add that directory to the $PATH
environment setting.
Invoke golint
with one or more filenames, directories, or packages named by its import path. Golint uses the same import path syntax as the go
command and therefore also supports relative import paths like ./...
. Additionally the ...
wildcard can be used as suffix on relative and absolute file paths to recurse into them.
The output of this tool is a list of suggestions in Vim quickfix format, which is accepted by lots of different editors.
Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes.
Golint differs from govet. Govet is concerned with correctness, whereas golint is concerned with coding style. Golint is in use at Google, and it seeks to match the accepted style of the open source Go project.
The suggestions made by golint are exactly that: suggestions. Golint is not perfect, and has both false positives and false negatives. Do not treat its output as a gold standard. We will not be adding pragmas or other knobs to suppress specific warnings, so do not expect or require code to be completely “lint-free”. In short, this tool is not, and will never be, trustworthy enough for its suggestions to be enforced automatically, for example as part of a build process. Golint makes suggestions for many of the mechanically checkable items listed in Effective Go and the CodeReviewComments wiki page.
Golint is meant to carry out the stylistic conventions put forth in Effective Go and CodeReviewComments. Changes that are not aligned with those documents will not be considered.
Add this to your ~/.vimrc:
set rtp+=$GOPATH/src/golang.org/x/lint/misc/vim
If you have multiple entries in your GOPATH, replace $GOPATH
with the right value.
Running :Lint
will run golint on the current file and populate the quickfix list.
Optionally, add this to your ~/.vimrc
to automatically run golint
on :w
autocmd BufWritePost,FileWritePost *.go execute 'Lint' | cwindow
Add this to your .emacs
file:
(add-to-list 'load-path (concat (getenv "GOPATH") "/src/golang.org/x/lint/misc/emacs/")) (require 'golint)
If you have multiple entries in your GOPATH, replace $GOPATH
with the right value.
Running M-x golint will run golint on the current file.
For more usage, see Compilation-Mode.