You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GolangCI-Lint is a linters aggregator. It is fast, easy to integrate and use, has nice output and has minimum count of false positives.
4
+
GolangCI-Lint is a linters aggregator. It is [fast](#performance) (2-6 times faster than gometalinter), [easy to integrate and use](#issues-options), has [nice output](quick-start) and has minimum count of false positives.
5
5
6
6
Sponsored by [GolangCI.com](https://golangci.com): SaaS service for running linters on Github pull requests. Free for Open Source.
* [golangci-lint vs gometalinter](#golangci-lint-vs-gometalinter)
14
+
* [golangci-lint vs Run Needed Linters Manually](#golangci-lint-vs-run-needed-linters-manually)
16
15
*[Performance](#performance)
17
16
* [Default Mode](#default-mode)
18
17
* [Fast Mode](#fast-mode)
@@ -93,9 +92,9 @@ $ golangci-lint run --disable-all -E errcheck
93
92
```
94
93
95
94
# Comparison
96
-
## `gometalinter`
95
+
## `golangci-lint` vs `gometalinter`
97
96
GolangCI-Lint was created to fix next issues with `gometalinter`:
98
-
1. Slow work: `gometalinter` usually works for minutes in average projects. GolangCI-Lint works [2-6x times faster](#benchmarks) by [reusing work](#internals).
97
+
1. Slow work: `gometalinter` usually works for minutes in average projects. GolangCI-Lint works [2-6x times faster](#performance) by [reusing work](#internals).
99
98
2. Huge memory consumption: parallel linters don't share the same program representation and can eat `n` times more memory (`n` - concurrency). GolangCI-Lint fixes it by sharing representation.
100
99
3. Can't set honest concurrency: if you set it to `n` it can take `n+x` threads because of forced threads in specific linters. `gometalinter` can't do anything about it, because it runs linters as black-boxes in forked processes. In GolangCI-Lint we run all linters in one process and fully control them. Configured concurrency will be honest.
101
100
This issue is important because often you'd like to set concurrency to CPUs count minus one to save one CPU for example for IDE. It concurrency isn't correct you will have troubles using IDE while analyzing code.
@@ -105,12 +104,14 @@ This issue is important because often you'd like to set concurrency to CPUs coun
105
104
7. Integration to large codebases. You can use `revgrep`, but it's yet another utility to install. With `golangci-lint` it's much easier: `revgrep` is already built into `golangci-lint` and you use it with one option (`-n, --new` or `--new-from-rev`).
106
105
8. Yaml or toml config. JSON isn't convenient for configuration files.
107
106
108
-
## Run Needed Linters Manually
109
-
1. It will be slower because `golangci-lint` shares 50-90% of linters work.
107
+
## `golangci-lint` vs Run Needed Linters Manually
108
+
1. It will be slower because `golangci-lint` shares 50-80% of linters work.
110
109
2. It will have fewer control and more false-positives: some linters can't be properly configured without hacks.
111
110
3. It will take more time because of different usages and need of tracking of version of `n` linters.
112
111
113
112
# Performance
113
+
Benchmarks were executed on MacBook Pro (Retina, 13-inch, Late 2013), 2,4 GHz Intel Core i5, 8 GB 1600 MHz DDR3. It has 4 cores and concurrency for linters was default: number of cores. Benchmark runs and measures timings automatically, it's code is [here](https://github.com/golangci/golangci-lint/blob/master/pkg/enabled_linters_test.go) (`BenchmarkWithGometalinter`).
114
+
114
115
## Default Mode
115
116
We compare golangci-lint and gometalinter in default mode, but explicitly specify all linters to enable because of small differences in default configuration.
On average golangci-lint is 2.5 times faster than gometalinter. Maximum difference is in
159
-
self repo: 3.1 times faster, minimum difference is in go source code repo: 17% faster.
160
+
self repo: 3.1 times faster, minimum difference is in go source code repo: 20% faster.
160
161
161
162
162
163
# Supported Linters
@@ -295,7 +296,7 @@ Configuration options inside file are identical to command-line options:
295
296
-[.golangci.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.yml) of this repo: we enable more linters than by default and make their settings more strict.
296
297
297
298
# False Positives
298
-
False positives are inevitable, but we did our best to reduce their count. If false postive occured you have next choices:
299
+
False positives are inevitable, but we did our best to reduce their count. For example, we have a enabled by default set of [exclude patterns](#issues-options). If false postive occured you have next choices:
299
300
1. Exclude issue text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type.
300
301
2. Exclude this one issue by using special comment `// nolint[:linter1,linter2,...]` on issued line.
301
302
Comment `// nolint` disables all issues reporting on this line. Comment e.g. `// nolint:govet` disables only govet issues for this line.
0 commit comments