- Notifications
You must be signed in to change notification settings - Fork486
[mirror] This is a linter for Go source code. (deprecated)
License
golang/lint
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
NOTE: Golint isdeprecated and frozen.There's no drop-in replacement for it, but tools such asStaticcheckandgo vet
should be used instead.
Golint is a linter for Go source code.
Golint requires asupported release of Go.
go get -u golang.org/x/lint/golint
To find out wheregolint
was installed you can rungo list -f {{.Target}} golang.org/x/lint/golint
. Forgolint
to be used globally add that directory to the$PATH
environment setting.
Invokegolint
with one or more filenames, directories, or packages namedby its import path. Golint uses the sameimport path syntax asthego
command and thereforealso supports relative import paths like./...
. Additionally the...
wildcard can be used as suffix on relative and absolute file paths to recurseinto 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, whereasgolint prints out style mistakes.
Golint differs from govet. Govet is concerned with correctness, whereasgolint is concerned with coding style. Golint is in use at Google, and itseeks 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 pragmasor other knobs to suppress specific warnings, so do not expect or requirecode to be completely "lint-free".In short, this tool is not, and will never be, trustworthy enough for itssuggestions to be enforced automatically, for example as part of a build process.Golint makes suggestions for many of the mechanically checkable items listed inEffective Go and theCodeReviewComments wiki page.
Golint is meant to carry out the stylistic conventions put forth inEffective Go andCodeReviewComments.Changes that are not aligned with those documents will not be considered.
Contributions to this project are welcome provided they arein scope,though please send mail before starting work on anything major.Contributors retain their copyright, so we need you to fill outa short formbefore we can accept your contribution.
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 rungolint
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, seeCompilation-Mode.
About
[mirror] This is a linter for Go source code. (deprecated)
Resources
License
Uh oh!
There was an error while loading.Please reload this page.