fix --version option and improve installation section of docs

This commit is contained in:
Denis Isaev 2018-06-03 09:25:47 +03:00
parent e8fb3a5166
commit ad3bf1eb58
No known key found for this signature in database
GPG Key ID: A36A0EC8E27A1A01
4 changed files with 47 additions and 38 deletions

View File

@ -13,16 +13,9 @@ Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running lint
* [Install](#install)
* [Quick Start](#quick-start)
* [Comparison](#comparison)
* [<code>golangci-lint</code> vs <code>gometalinter</code>](#golangci-lint-vs-gometalinter)
* [<code>golangci-lint</code> vs Run Needed Linters Manually](#golangci-lint-vs-run-needed-linters-manually)
* [Performance](#performance)
* [Comparison with gometalinter](#comparison-with-gometalinter)
* [Supported Linters](#supported-linters)
* [Enabled By Default Linters](#enabled-by-default-linters)
* [Disabled By Default Linters (-E/--enable)](#disabled-by-default-linters--e--enable)
* [Configuration](#configuration)
* [Command-Line Options](#command-line-options)
* [Configuration File](#configuration-file)
* [False Positives](#false-positives)
* [IDE integrations](#ide-integrations)
* [Internals](#internals)
@ -40,7 +33,26 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
[![asciicast](https://asciinema.org/a/183662.png)](https://asciinema.org/a/183662)
# Install
Recommended way to install is:
## CI Installation
The most installations are done for CI (travis, circleci etc). It's important to have reproducable CI:
don't start to fail all builds at one moment. With golangci-lint this can cappen if you
use `--enable-all` and new linter is added or even without `--enable-all`: when one linter
was upgraded from the upstream.
Therefore it's highly recommended to install a fixed version of golangci-lint.
Find needed version on the [releases page](https://github.com/golangci/golangci-lint/releases).
The recommended way to install golangci-lint is the next:
```bash
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s VERSION
```
Periodically update version of golangci-lint: we do active development
and deliver a lot of improvements. But do it explicitly with checking of
newly found issues.
## Local Installation
It's a not recommended for CI method. Do it only for the local development.
```bash
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
```
@ -48,16 +60,9 @@ go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
You can also install it by brew:
```bash
brew install golangci/tap/golangci-lint
brew upgrade golangci/tap/golangci-lint
```
For CI you can use fast local installation:
```bash
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
```
Check the [releases page](https://github.com/golangci/golangci-lint/releases) to fix the version.
# Quick Start
To run golangci-lint execute:
```bash

View File

@ -13,16 +13,9 @@ Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running lint
* [Install](#install)
* [Quick Start](#quick-start)
* [Comparison](#comparison)
* [<code>golangci-lint</code> vs <code>gometalinter</code>](#golangci-lint-vs-gometalinter)
* [<code>golangci-lint</code> vs Run Needed Linters Manually](#golangci-lint-vs-run-needed-linters-manually)
* [Performance](#performance)
* [Comparison with gometalinter](#comparison-with-gometalinter)
* [Supported Linters](#supported-linters)
* [Enabled By Default Linters](#enabled-by-default-linters)
* [Disabled By Default Linters (-E/--enable)](#disabled-by-default-linters--e--enable)
* [Configuration](#configuration)
* [Command-Line Options](#command-line-options)
* [Configuration File](#configuration-file)
* [False Positives](#false-positives)
* [IDE integrations](#ide-integrations)
* [Internals](#internals)
@ -40,7 +33,26 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
[![asciicast](https://asciinema.org/a/183662.png)](https://asciinema.org/a/183662)
# Install
Recommended way to install is:
## CI Installation
The most installations are done for CI (travis, circleci etc). It's important to have reproducable CI:
don't start to fail all builds at one moment. With golangci-lint this can cappen if you
use `--enable-all` and new linter is added or even without `--enable-all`: when one linter
was upgraded from the upstream.
Therefore it's highly recommended to install a fixed version of golangci-lint.
Find needed version on the [releases page](https://github.com/golangci/golangci-lint/releases).
The recommended way to install golangci-lint is the next:
```bash
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s VERSION
```
Periodically update version of golangci-lint: we do active development
and deliver a lot of improvements. But do it explicitly with checking of
newly found issues.
## Local Installation
It's a not recommended for CI method. Do it only for the local development.
```bash
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
```
@ -48,16 +60,9 @@ go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
You can also install it by brew:
```bash
brew install golangci/tap/golangci-lint
brew upgrade golangci/tap/golangci-lint
```
For CI you can use fast local installation:
```bash
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
```
Check the [releases page](https://github.com/golangci/golangci-lint/releases) to fix the version.
# Quick Start
To run golangci-lint execute:
```bash

View File

@ -18,7 +18,10 @@ type Executor struct {
func NewExecutor(version, commit, date string) *Executor {
e := &Executor{
cfg: &config.Config{},
cfg: &config.Config{},
version: version,
commit: commit,
date: date,
}
logrus.SetLevel(logrus.WarnLevel)
@ -27,10 +30,6 @@ func NewExecutor(version, commit, date string) *Executor {
e.initRun()
e.initLinters()
e.version = version
e.commit = commit
e.date = date
return e
}

View File

@ -90,7 +90,7 @@ func (e *Executor) initRootFlagSet(fs *pflag.FlagSet) {
fs.StringVar(&e.cfg.Run.CPUProfilePath, "cpu-profile-path", "", wh("Path to CPU profile output file"))
fs.StringVar(&e.cfg.Run.MemProfilePath, "mem-profile-path", "", wh("Path to memory profile output file"))
fs.IntVarP(&e.cfg.Run.Concurrency, "concurrency", "j", getDefaultConcurrency(), wh("Concurrency (default NumCPU)"))
if e.commit != "" {
if e.date != "" {
fs.BoolVar(&e.cfg.Run.PrintVersion, "version", false, wh("Print version"))
}
}