Update .travis.yml for latest conventions, use fast_finish, test with -race. (#279)

* Update .travis.yml for latest conventions, use fast_finish, test with -race.

This change follows #277, but updates .travis.yml to use latest
conventions as documented at https://docs.travis-ci.com/user/languages/go#Specifying-a-Go-version-to-use.
Specifically, use master instead of tip to refer to latest (unreleased)
version of Go.

Use .x to target latest patch releases of each point release of Go.

Use fast_finish to speed up build reporting with no semantic change.
It's documented at https://blog.travis-ci.com/2013-11-27-fast-finishing-builds/.

Use race detector when running tests.

* Update .travis.yml to migrate from legacy to container-based infrastructure.

If lint doesn't do anything that would require sudo access,
it's a good idea not to require sudo access. This allows the builds
to run on Travis' newer container-based infrastructure, which
are not considered legacy and should run faster.
See https://docs.travis-ci.com/user/migrating-from-legacy/ for details.
1 file changed
tree: d493030178449098077cd71b03766357f852156b
  1. golint/
  2. misc/
  3. testdata/
  4. .travis.yml
  5. CONTRIBUTING.md
  6. LICENSE
  7. lint.go
  8. lint_test.go
  9. README.md
README.md

Golint is a linter for Go source code.

Build Status

Installation

Golint requires Go 1.6 or later.

go get -u github.com/golang/lint/golint

Usage

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.

Purpose

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.

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

Contributions

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.

Vim

Add this to your ~/.vimrc:

set rtp+=$GOPATH/src/github.com/golang/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

Emacs

Add this to your .emacs file:

(add-to-list 'load-path (concat (getenv "GOPATH")  "/src/github.com/golang/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.