Skip to content

Commit 5862a4b

Browse files
authored
Language changes and fixed some typos.
Language changes and fixed some typos.
1 parent 61c0974 commit 5862a4b

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

README.md

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,30 @@ Short 1.5 min video demo of analyzing [beego](https://github.com/astaxie/beego).
3434

3535
# Install
3636
## 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.
37+
Most installations are done for CI (travis, circleci etc). It's important to have reproducible CI:
38+
don't start to fail all builds at the same time. With golangci-lint this can happen if you
39+
use `--enable-all` and a new linter is added or even without `--enable-all`: when one upstream linter
40+
is upgraded.
4141

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).
42+
It's highly recommended to install a fixed version of golangci-lint.
43+
Releases are available on the [releases page](https://github.com/golangci/golangci-lint/releases).
4444

45-
The recommended way to install golangci-lint is the next:
45+
The recommended way to install golangci-lint:
4646
```bash
4747
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s VERSION
4848
```
4949

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.
50+
Periodically update version of golangci-lint: the project is under active development
51+
and is constantly being improved. But please always check for newly found issues and
52+
update if needed.
5353

5454
## Local Installation
55-
It's a not recommended for CI method. Do it only for the local development.
55+
It's a not recommended for your CI pipeline. Only install like this for your local development environment.
5656
```bash
5757
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
5858
```
5959

60-
You can also install it by brew:
60+
You can also install it on OSX using brew:
6161
```bash
6262
brew install golangci/tap/golangci-lint
6363
brew upgrade golangci/tap/golangci-lint
@@ -78,9 +78,9 @@ You can choose which directories and files to analyze:
7878
```bash
7979
golangci-lint run dir1 dir2/... dir3/file1.go
8080
```
81-
Directories are analyzed NOT recursively, to analyze them recursively append `/...` to their path.
81+
Directories are NOT analyzed recursively. To analyze them recursively append `/...` to their path.
8282

83-
GolangCI-Lint can be used with zero configuration. By default next linters are enabled:
83+
GolangCI-Lint can be used with zero configuration. By default the following linters are enabled:
8484
```
8585
$ golangci-lint linters
8686
Enabled by default linters:
@@ -97,7 +97,7 @@ deadcode: Finds unused code [fast: false]
9797
typecheck: Like the front-end of a Go compiler, parses and type-checks Go code [fast: false]
9898
```
9999

100-
and next linters are disabled by default:
100+
and the following linters are disabled by default:
101101
```
102102
$ golangci-lint linters
103103
...
@@ -131,32 +131,32 @@ $ golangci-lint run --disable-all -E errcheck
131131

132132
# Comparison
133133
## `golangci-lint` vs `gometalinter`
134-
GolangCI-Lint was created to fix next issues with `gometalinter`:
134+
GolangCI-Lint was created to fix the following issues with `gometalinter`:
135135
1. Slow work: `gometalinter` usually works for minutes in average projects. **GolangCI-Lint works [2-7x times faster](#performance)** by [reusing work](#internals).
136-
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 and **eats 1.35x less memory**.
137-
3. Can't set honest concurrency: if you set it to `n` it can take up to `n*n` 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.
138-
This issue is important because often you'd like to set concurrency to CPUs count minus one to **not freeze your PC** and be able to work on it while analyzing code.
139-
4. Lack of nice output. We like how compilers `gcc` and `clang` format their warnings: **using colors, printing of warned line and showing position in line**.
140-
5. Too many issues. GolangCI-Lint cuts a lot of issues by using default exclude list of common false-positives. Also, it has enabled by default **smart issues processing**: merge multiple issues for one line, merge issues with the same text or from the same linter. All of these smart processors can be configured by the user.
141-
6. Integration to large codebases. A good way to start using linters in a large project is not to fix all hundreds on existing issues, but setup CI and **fix only issues in new commits**. You can use `revgrep` for it, but it's yet another utility to install and configure. With `golangci-lint` it's much easier: `revgrep` is already built into `golangci-lint` and you can use it with one option (`-n, --new` or `--new-from-rev`).
142-
7. Installation. With `gometalinter`, you need to run linters installation step. It's easy to forget this step and have stale linters. It also complicates CI setup. GolangCI-Lint requires **no installation of linters**.
143-
8. **Yaml or toml config**. Gometalinter's JSON isn't convenient for configuration files.
144-
145-
## `golangci-lint` vs Run Needed Linters Manually
136+
2. Huge memory consumption: parallel linters don't share the same program representation and can consume `n` times more memory (`n` - concurrency). GolangCI-Lint fixes it by sharing representation and **consumes 1.35x less memory**.
137+
3. Doesn't use real bounded concurrency: if you set it to `n` it can take up to `n*n` 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 completely control them. Configured concurrency will be correctly bounded.
138+
This issue is important because you often want to set concurrency to the CPUs count minus one to ensure you **do not freeze your PC** and be able to work on it while analyzing code.
139+
4. Lack of nice output. We like how the `gcc` and `clang` compilers format their warnings: **using colors, printing warning lines and showing the position in line**.
140+
5. Too many issues. GolangCI-Lint cuts a lot of issues by using default exclude list of common false-positives. By default, it has enables **smart issues processing**: merge multiple issues for one line, merge issues with the same text or from the same linter. All of these smart processors can be configured by the user.
141+
6. Integration into large codebases. A good way to start using linters in a large project is not to fix a plethora of existing issues, but to set up CI and **fix only issues in new commits**. You can use `revgrep` for it, but it's yet another utility to install and configure. With `golangci-lint` it's much easier: `revgrep` is already built into `golangci-lint` and you can use it with one option (`-n, --new` or `--new-from-rev`).
142+
7. Installation. With `gometalinter`, you need to run a linters installation step. It's easy to forget this step and end up with stale linters. It also complicates CI setup. GolangCI-Lint requires **no installation of linters**.
143+
8. **Yaml or toml config**. Gometalinter's JSON isn't convenient for config files.
144+
145+
## `golangci-lint` vs Running Linters Manually
146146
1. It will be much slower because `golangci-lint` runs all linters in parallel and shares 50-80% of linters work.
147147
2. It will have less control and more false-positives: some linters can't be properly configured without hacks.
148148
3. It will take more time because of different usages and need of tracking of versions of `n` linters.
149149

150150
# Performance
151151
Benchmarks were executed on MacBook Pro (Retina, 13-inch, Late 2013), 2,4 GHz Intel Core i5, 8 GB 1600 MHz DDR3.
152-
It has 4 cores and concurrency for linters was default: number of cores.
153-
Benchmark runs and measures timings automatically, it's code is
152+
It has 4 cores and concurrent linting as a default consuming all cores.
153+
Benchmark were run (and measured) automatically, see the code
154154
[here](https://github.com/golangci/golangci-lint/blob/master/test/bench_test.go) (`BenchmarkWithGometalinter`).
155155

156156
We measure peak memory usage (RSS) by tracking of processes RSS every 5 ms.
157157

158158
## Comparison with gometalinter
159-
We compare golangci-lint and gometalinter in default mode, but explicitly specify all linters to enable because of small differences in the default configuration.
159+
We compare golangci-lint and gometalinter in default mode, but explicitly enabl all linters because of small differences in the default configuration.
160160
```bash
161161
$ golangci-lint run --no-config --issues-exit-code=0 --deadline=30m \
162162
--disable-all --enable=deadcode --enable=gocyclo --enable=golint --enable=varcheck \
@@ -188,7 +188,7 @@ self-repo: **7.5 times faster**, minimum difference is in terraform source code
188188
On average golangci-lint consumes 1.35 times less memory.
189189

190190
# Supported Linters
191-
To see a list of supported linters and which linters are enabled/disabled by default execute a command
191+
To see a list of supported linters and which linters are enabled/disabled:
192192
```
193193
golangci-lint linters
194194
```
@@ -220,9 +220,9 @@ golangci-lint linters
220220
- [depguard](https://github.com/OpenPeeDeeP/depguard) - Go linter that checks if package imports are in a list of acceptable packages
221221

222222
# Configuration
223-
Configuration file has lower priority than command-line: if the same bool/string/int option defined in the command-line
224-
and in the configuration file, option from command-line will be used.
225-
Slice options (e.g. list of enabled/disabled linters) are combined from the command-line and configuration file.
223+
The config file has lower priority than command-line options. If the same bool/string/int option is provided on the command-line
224+
and in the config file, the option from command-line will be used.
225+
Slice options (e.g. list of enabled/disabled linters) are combined from the command-line and config file.
226226

227227
## Command-Line Options
228228
```
@@ -298,22 +298,22 @@ Global Flags:
298298
299299
```
300300

301-
## Configuration File
302-
GolangCI-Lint looks for next config paths in the current directory:
301+
## Config File
302+
GolangCI-Lint looks for config files in the following paths from the current working directory:
303303
- `.golangci.yml`
304304
- `.golangci.toml`
305305
- `.golangci.json`
306306

307-
GolangCI-Lint also searches config file in all directories from directory of the first analyzed path up to the root.
308-
To see which config file is used and where it was searched run golangci-lint with `-v` option.
307+
GolangCI-Lint also searches for config files in all directories from the directory of the first analyzed path up to the root.
308+
To see which config file is being used and where it was sourced from run golangci-lint with `-v` option.
309309

310-
Configuration options inside the file are identical to command-line options.
311-
You can configure specific linters options only within configuration file, it can't be done with command-line.
310+
Config options inside the file are identical to command-line options.
311+
You can configure specific linters' options only within the config file (not the command-line).
312312

313-
There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) with all supported options.
313+
There is a [`.golangci.yml`](https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml) example config file with all supported options.
314314

315-
It's a [.golangci.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.yml) of this repo: we enable more linters
316-
than by default and make their settings more strict:
315+
It's a [.golangci.yml](https://github.com/golangci/golangci-lint/blob/master/.golangci.yml) config file of this repo: we enable more linters
316+
than the default and more strict settings:
317317
```yaml
318318
linters-settings:
319319
govet:
@@ -337,7 +337,7 @@ linters:
337337
```
338338
339339
# False Positives
340-
False positives are inevitable, but we did our best to reduce their count. For example, we have an enabled by default set of [exclude patterns](#issues-options). If false positive occurred you have next choices:
340+
False positives are inevitable, but we did our best to reduce their count. For example, we have a default enabled set of [exclude patterns](#issues-options). If a false positive occurred you have the following choices:
341341
1. Exclude issue by text using command-line option `-e` or config option `issues.exclude`. It's helpful when you decided to ignore all issues of this type.
342342
2. Exclude this one issue by using special comment `// nolint[:linter1,linter2,...]` on issued line.
343343
Comment `// nolint` disables all issues reporting on this line. Comment e.g. `// nolint:govet` disables only govet issues for this line.
@@ -350,7 +350,7 @@ func f() {
350350
}
351351
```
352352

353-
Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) about found false positives. We will add it to default exclude list if it's common or we will fix underlying linter.
353+
Please create [GitHub Issues here](https://github.com/golangci/golangci-lint/issues/new) if you find any false positives. We will add it to the default exclude list if it's common or we will fix underlying linter.
354354

355355
# Internals
356356
The key difference with gometalinter is that golangci-lint shares work between specific linters (golint, govet, ...).
@@ -362,29 +362,29 @@ reuse `AST` parsing and traversal.
362362
We don't fork to call specific linter but use its API. We forked GitHub repos of almost all linters
363363
to make API. It also allows us to be more performant and control actual count of used threads.
364364

365-
All linters are vendored in `/vendor` folder: their version is fixed, they are builtin
365+
All linters are vendored in the `/vendor` folder: their version is fixed, they are builtin
366366
and you don't need to install them separately.
367367

368368
We use chains for issues and independent processors to post-process them: exclude issues by limits,
369-
nolint comment, diff, regexps; prettify paths etc.
369+
nolint comment, diff, regexps; prettify paths, etc.
370370

371-
We use `cobra` for command-line action.
371+
We use `cobra` for command-line options.
372372

373373
# FAQ
374-
**Q: How to add custom linter?**
374+
**Q: How do you add a custom linter?**
375375

376-
A: You can integrate it yourself, see this [wiki page](https://github.com/golangci/golangci-lint/wiki/How-to-add-a-custom-linter) with documentation. Or you can create [GitHub Issue](https://github.com/golangci/golangci-lint/issues/new) and we will integrate it soon.
376+
A: You can integrate it yourself, see this [wiki page](https://github.com/golangci/golangci-lint/wiki/How-to-add-a-custom-linter) with documentation. Or you can create a [GitHub Issue](https://github.com/golangci/golangci-lint/issues/new) and we will integrate when time permits.
377377

378378
**Q: It's cool to use `golangci-lint` when starting a project, but what about existing projects with large codebase? It will take days to fix all found issues**
379379

380380
A: We are sure that every project can easily integrate `golangci-lint`, even the large one. The idea is to not fix all existing issues. Fix only newly added issue: issues in new code. To do this setup CI (or better use [GolangCI](https://golangci.com) to run `golangci-lint` with option `--new-from-rev=origin/master`. Also, take a look at option `-n`.
381-
By doing this you won't create new issues in code and can smoothly fix existing issues (or not).
381+
By doing this you won't create new issues in your code and can choose fix existing issues (or not).
382382

383383
**Q: How to use `golangci-lint` in CI (Continuous Integration)?**
384384

385385
A: You have 2 choices:
386386
1. Use [GolangCI](https://golangci.com): this service is highly integrated with GitHub (issues are commented in the pull request) and uses a `golangci-lint` tool. For configuration use `.golangci.yml` (or toml/json).
387-
2. Use custom CI: just run `golangci-lint` in CI and check the exit code. If it's non-zero - fail the build. The main disadvantage is that you can't see found issues in pull request code and should view build log, then open needed source file to see a context.
387+
2. Use custom CI: just run `golangci-lint` in CI and check the exit code. If it's non-zero - fail the build. The main disadvantage is that you can't see issues in pull request code and would need to view the build log, then open the referenced source file to see the context.
388388
If you'd like to vendor `golangci-lint` in your repo, run:
389389
```bash
390390
go get -u github.com/golang/dep/cmd/dep
@@ -406,7 +406,7 @@ Vendoring `golangci-lint` saves a network request, potentially making your CI sy
406406
**Q: `golangci-lint` doesn't work**
407407
1. Update it: `go get -u github.com/golangci/golangci-lint/cmd/golangci-lint`
408408
2. Run it with `-v` option and check the output.
409-
3. If it doesn't help create [GitHub issue](https://github.com/golangci/golangci-lint/issues/new) with the output.
409+
3. If it doesn't help create a [GitHub issue](https://github.com/golangci/golangci-lint/issues/new) with the output from the error and #2 above.
410410

411411
# Thanks
412412
Thanks to [alecthomas/gometalinter](https://github.com/alecthomas/gometalinter) for inspiration and amazing work.
@@ -431,7 +431,7 @@ Thanks to developers and authors of used linters:
431431
1. Upstream all changes of forked linters.
432432
2. Fully integrate all used linters: make a common interface and reuse 100% of what can be reused: AST traversal, packages preparation etc.
433433
3. Make it easy to write own linter/checker: it should take a minimum code, have perfect documentation, debugging and testing tooling.
434-
4. Speedup packages loading (dig into [loader](golang.org/x/tools/go/loader)): on-disk cache and existing code profiling-optimizing.
434+
4. Speed up package loading (dig into [loader](golang.org/x/tools/go/loader)): on-disk cache and existing code profiling-optimizing.
435435
5. Analyze (don't only filter) only new code: analyze only changed files and dependencies, make incremental analysis, caches.
436436
6. Smart new issues detector: don't print existing issues on changed lines.
437437
7. Integration with Text Editors. On-the-fly code analysis for text editors: it should be super-fast.

0 commit comments

Comments
 (0)