lint

package module
v0.0.0-...-dbd4ec6 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2013 License: BSD-3-Clause Imports: 8 Imported by: 0

README

golint is a linter for Go source code.

Invoke golint with one or more filenames.
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 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".
Unlimited effort will not be expended to make golint perfect.
It is considered an abuse of this tool to run it for machine consumption.

If you find an established style that is frequently violated, and which
you think golint could statically check, file an issue at
  https://github.com/golang/lint/issues


Vim
---
Add this to your ~/.vimrc:
  function! s:GoLint()
    cexpr system("golint " . shellescape(expand('%')))
    copen
  endfunction
  command! GoLint :call s:GoLint()

Running :GoLint will run golint on the current file and populate the quickfix list.

Documentation

Overview

Package lint contains a linter for Go source code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	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

Directories

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