package module
Version: v0.0.0-...-f6cf4f8 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2014 License: BSD-3-Clause Imports: 12 Imported by: 0


Golint is a linter for Go source code.

To install, run
  go get

Invoke golint with one or more filenames or directories.
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.

If you find an established style that is frequently violated, and which
you think golint could statically check, file an issue at

Contributions to this project are welcome, though please send mail before
starting work on anything major. Contributors retain their copyright, so we
need you to fill out a short form before we can accept your contribution:

Add this to your ~/.vimrc:
  set rtp+=$GOPATH/src/
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/"))
  (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:



Package lint contains a linter for Go source code.



This section is empty.


This section is empty.


func GitBlameFileAtLine

func GitBlameFileAtLine(filename string, line int) string


type Linter

type Linter struct {

A Linter lints Go source code.

func (*Linter) Lint

func (l *Linter) Lint(filename string, src []byte) ([]Problem, error)

Lint lints src.

type Problem

type Problem struct {
	Position   token.Position // position in source file
	Text       string         // the prose that describes the problem
	Link       string         // (optional) the link to the style guide for the problem
	Confidence float64        // a value in (0,1] estimating the confidence in this problem's correctness
	LineText   string         // the source line

Problem represents a problem in some source code.

func (*Problem) String

func (p *Problem) String() string

Source Files


Path Synopsis
golint lints the Go source files named on its command line.
golint lints the Go source files named on its command line.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL