fix --version option and improve installation section of docs
This commit is contained in:
parent
e8fb3a5166
commit
ad3bf1eb58
37
README.md
37
README.md
@ -13,16 +13,9 @@ Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running lint
|
|||||||
* [Install](#install)
|
* [Install](#install)
|
||||||
* [Quick Start](#quick-start)
|
* [Quick Start](#quick-start)
|
||||||
* [Comparison](#comparison)
|
* [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)
|
* [Performance](#performance)
|
||||||
* [Comparison with gometalinter](#comparison-with-gometalinter)
|
|
||||||
* [Supported Linters](#supported-linters)
|
* [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)
|
* [Configuration](#configuration)
|
||||||
* [Command-Line Options](#command-line-options)
|
|
||||||
* [Configuration File](#configuration-file)
|
|
||||||
* [False Positives](#false-positives)
|
* [False Positives](#false-positives)
|
||||||
* [IDE integrations](#ide-integrations)
|
* [IDE integrations](#ide-integrations)
|
||||||
* [Internals](#internals)
|
* [Internals](#internals)
|
||||||
@ -40,7 +33,26 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
|
|||||||
[](https://asciinema.org/a/183662)
|
[](https://asciinema.org/a/183662)
|
||||||
|
|
||||||
# Install
|
# 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
|
```bash
|
||||||
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
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:
|
You can also install it by brew:
|
||||||
```bash
|
```bash
|
||||||
brew install golangci/tap/golangci-lint
|
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
|
# Quick Start
|
||||||
To run golangci-lint execute:
|
To run golangci-lint execute:
|
||||||
```bash
|
```bash
|
||||||
|
@ -13,16 +13,9 @@ Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running lint
|
|||||||
* [Install](#install)
|
* [Install](#install)
|
||||||
* [Quick Start](#quick-start)
|
* [Quick Start](#quick-start)
|
||||||
* [Comparison](#comparison)
|
* [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)
|
* [Performance](#performance)
|
||||||
* [Comparison with gometalinter](#comparison-with-gometalinter)
|
|
||||||
* [Supported Linters](#supported-linters)
|
* [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)
|
* [Configuration](#configuration)
|
||||||
* [Command-Line Options](#command-line-options)
|
|
||||||
* [Configuration File](#configuration-file)
|
|
||||||
* [False Positives](#false-positives)
|
* [False Positives](#false-positives)
|
||||||
* [IDE integrations](#ide-integrations)
|
* [IDE integrations](#ide-integrations)
|
||||||
* [Internals](#internals)
|
* [Internals](#internals)
|
||||||
@ -40,7 +33,26 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
|
|||||||
[](https://asciinema.org/a/183662)
|
[](https://asciinema.org/a/183662)
|
||||||
|
|
||||||
# Install
|
# 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
|
```bash
|
||||||
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
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:
|
You can also install it by brew:
|
||||||
```bash
|
```bash
|
||||||
brew install golangci/tap/golangci-lint
|
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
|
# Quick Start
|
||||||
To run golangci-lint execute:
|
To run golangci-lint execute:
|
||||||
```bash
|
```bash
|
||||||
|
@ -18,7 +18,10 @@ type Executor struct {
|
|||||||
|
|
||||||
func NewExecutor(version, commit, date string) *Executor {
|
func NewExecutor(version, commit, date string) *Executor {
|
||||||
e := &Executor{
|
e := &Executor{
|
||||||
cfg: &config.Config{},
|
cfg: &config.Config{},
|
||||||
|
version: version,
|
||||||
|
commit: commit,
|
||||||
|
date: date,
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.SetLevel(logrus.WarnLevel)
|
logrus.SetLevel(logrus.WarnLevel)
|
||||||
@ -27,10 +30,6 @@ func NewExecutor(version, commit, date string) *Executor {
|
|||||||
e.initRun()
|
e.initRun()
|
||||||
e.initLinters()
|
e.initLinters()
|
||||||
|
|
||||||
e.version = version
|
|
||||||
e.commit = commit
|
|
||||||
e.date = date
|
|
||||||
|
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.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.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)"))
|
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"))
|
fs.BoolVar(&e.cfg.Run.PrintVersion, "version", false, wh("Print version"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user