Skip to content

Commit ad3bf1e

Browse files
committed
fix --version option and improve installation section of docs
1 parent e8fb3a5 commit ad3bf1e

File tree

4 files changed

+47
-38
lines changed

4 files changed

+47
-38
lines changed

Diff for: README.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,9 @@ Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running lint
1313
* [Install](#install)
1414
* [Quick Start](#quick-start)
1515
* [Comparison](#comparison)
16-
* [<code>golangci-lint</code> vs <code>gometalinter</code>](#golangci-lint-vs-gometalinter)
17-
* [<code>golangci-lint</code> vs Run Needed Linters Manually](#golangci-lint-vs-run-needed-linters-manually)
1816
* [Performance](#performance)
19-
* [Comparison with gometalinter](#comparison-with-gometalinter)
2017
* [Supported Linters](#supported-linters)
21-
* [Enabled By Default Linters](#enabled-by-default-linters)
22-
* [Disabled By Default Linters (-E/--enable)](#disabled-by-default-linters--e--enable)
2318
* [Configuration](#configuration)
24-
* [Command-Line Options](#command-line-options)
25-
* [Configuration File](#configuration-file)
2619
* [False Positives](#false-positives)
2720
* [IDE integrations](#ide-integrations)
2821
* [Internals](#internals)
@@ -40,24 +33,36 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
4033
[![asciicast](https://asciinema.org/a/183662.png)](https://asciinema.org/a/183662)
4134

4235
# Install
43-
Recommended way to install is:
36+
## CI Installation
37+
The most installations are done for CI (travis, circleci etc). It's important to have reproducable CI:
38+
don't start to fail all builds at one moment. With golangci-lint this can cappen if you
39+
use `--enable-all` and new linter is added or even without `--enable-all`: when one linter
40+
was upgraded from the upstream.
41+
42+
Therefore it's highly recommended to install a fixed version of golangci-lint.
43+
Find needed version on the [releases page](https://github.com/golangci/golangci-lint/releases).
44+
45+
The recommended way to install golangci-lint is the next:
4446
```bash
45-
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
47+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s VERSION
4648
```
4749

48-
You can also install it by brew:
50+
Periodically update version of golangci-lint: we do active development
51+
and deliver a lot of improvements. But do it explicitly with checking of
52+
newly found issues.
53+
54+
## Local Installation
55+
It's a not recommended for CI method. Do it only for the local development.
4956
```bash
50-
brew install golangci/tap/golangci-lint
57+
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
5158
```
5259

53-
For CI you can use fast local installation:
60+
You can also install it by brew:
5461
```bash
55-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
62+
brew install golangci/tap/golangci-lint
63+
brew upgrade golangci/tap/golangci-lint
5664
```
5765

58-
Check the [releases page](https://github.com/golangci/golangci-lint/releases) to fix the version.
59-
60-
6166
# Quick Start
6267
To run golangci-lint execute:
6368
```bash

Diff for: README.md.tmpl

+21-16
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,9 @@ Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running lint
1313
* [Install](#install)
1414
* [Quick Start](#quick-start)
1515
* [Comparison](#comparison)
16-
* [<code>golangci-lint</code> vs <code>gometalinter</code>](#golangci-lint-vs-gometalinter)
17-
* [<code>golangci-lint</code> vs Run Needed Linters Manually](#golangci-lint-vs-run-needed-linters-manually)
1816
* [Performance](#performance)
19-
* [Comparison with gometalinter](#comparison-with-gometalinter)
2017
* [Supported Linters](#supported-linters)
21-
* [Enabled By Default Linters](#enabled-by-default-linters)
22-
* [Disabled By Default Linters (-E/--enable)](#disabled-by-default-linters--e--enable)
2318
* [Configuration](#configuration)
24-
* [Command-Line Options](#command-line-options)
25-
* [Configuration File](#configuration-file)
2619
* [False Positives](#false-positives)
2720
* [IDE integrations](#ide-integrations)
2821
* [Internals](#internals)
@@ -40,24 +33,36 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
4033
[![asciicast](https://asciinema.org/a/183662.png)](https://asciinema.org/a/183662)
4134

4235
# Install
43-
Recommended way to install is:
36+
## CI Installation
37+
The most installations are done for CI (travis, circleci etc). It's important to have reproducable CI:
38+
don't start to fail all builds at one moment. With golangci-lint this can cappen if you
39+
use `--enable-all` and new linter is added or even without `--enable-all`: when one linter
40+
was upgraded from the upstream.
41+
42+
Therefore it's highly recommended to install a fixed version of golangci-lint.
43+
Find needed version on the [releases page](https://github.com/golangci/golangci-lint/releases).
44+
45+
The recommended way to install golangci-lint is the next:
4446
```bash
45-
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
47+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s VERSION
4648
```
4749

48-
You can also install it by brew:
50+
Periodically update version of golangci-lint: we do active development
51+
and deliver a lot of improvements. But do it explicitly with checking of
52+
newly found issues.
53+
54+
## Local Installation
55+
It's a not recommended for CI method. Do it only for the local development.
4956
```bash
50-
brew install golangci/tap/golangci-lint
57+
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
5158
```
5259

53-
For CI you can use fast local installation:
60+
You can also install it by brew:
5461
```bash
55-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
62+
brew install golangci/tap/golangci-lint
63+
brew upgrade golangci/tap/golangci-lint
5664
```
5765

58-
Check the [releases page](https://github.com/golangci/golangci-lint/releases) to fix the version.
59-
60-
6166
# Quick Start
6267
To run golangci-lint execute:
6368
```bash

Diff for: pkg/commands/executor.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ type Executor struct {
1818

1919
func NewExecutor(version, commit, date string) *Executor {
2020
e := &Executor{
21-
cfg: &config.Config{},
21+
cfg: &config.Config{},
22+
version: version,
23+
commit: commit,
24+
date: date,
2225
}
2326

2427
logrus.SetLevel(logrus.WarnLevel)
@@ -27,10 +30,6 @@ func NewExecutor(version, commit, date string) *Executor {
2730
e.initRun()
2831
e.initLinters()
2932

30-
e.version = version
31-
e.commit = commit
32-
e.date = date
33-
3433
return e
3534
}
3635

Diff for: pkg/commands/root.go

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

0 commit comments

Comments
 (0)