docs: improve integrations and install pages (#4719)
This commit is contained in:
parent
27355d9b09
commit
78ade26f89
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 90 KiB |
BIN
docs/src/docs/welcome/colored-line-number.png
Normal file
BIN
docs/src/docs/welcome/colored-line-number.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
@ -6,25 +6,28 @@ title: "Install"
|
|||||||
|
|
||||||
Most installations of `golangci-lint` are performed for CI.
|
Most installations of `golangci-lint` are performed for CI.
|
||||||
|
|
||||||
### GitHub Actions
|
|
||||||
|
|
||||||
We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint-action) for running `golangci-lint` in CI for GitHub projects.
|
|
||||||
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside,
|
|
||||||
and it can be much faster than the simple binary installation.
|
|
||||||
|
|
||||||
Also, the action creates GitHub annotations for found issues: you don't need to dig into build log to see found by `golangci-lint` issues:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Other CI
|
|
||||||
|
|
||||||
It's important to have reproducible CI: don't start to fail all builds at the same time.
|
It's important to have reproducible CI: don't start to fail all builds at the same time.
|
||||||
With golangci-lint this can happen if you use option `--enable-all` and a new linter is added
|
With golangci-lint this can happen if you use option `--enable-all` and a new linter is added
|
||||||
or even without `--enable-all` when one upstream linter is upgraded.
|
or even without `--enable-all` when one upstream linter is upgraded.
|
||||||
|
|
||||||
**IMPORTANT**: It's highly recommended installing a specific version of golangci-lint available on the [releases page](https://github.com/golangci/golangci-lint/releases).
|
**IMPORTANT**: It's highly recommended installing a specific version of golangci-lint available on the [releases page](https://github.com/golangci/golangci-lint/releases).
|
||||||
|
|
||||||
Here is the recommended way to install golangci-lint {.LatestVersion}:
|
### GitHub Actions
|
||||||
|
|
||||||
|
We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint-action) for running `golangci-lint` in CI for GitHub projects.
|
||||||
|
|
||||||
|
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside,
|
||||||
|
and it can be much faster than the simple binary installation.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Also, the action creates GitHub annotations for found issues (you don't need to dig into build log to see found by `golangci-lint` issues):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Other CI
|
||||||
|
|
||||||
|
Here is the other way to install golangci-lint:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# binary will be $(go env GOPATH)/bin/golangci-lint
|
# binary will be $(go env GOPATH)/bin/golangci-lint
|
||||||
@ -55,23 +58,11 @@ golangci-lint --version
|
|||||||
|
|
||||||
On Windows, you can run the above commands with Git Bash, which comes with [Git for Windows](https://git-scm.com/download/win).
|
On Windows, you can run the above commands with Git Bash, which comes with [Git for Windows](https://git-scm.com/download/win).
|
||||||
|
|
||||||
### Docker
|
### Linux
|
||||||
|
|
||||||
```sh
|
Golangci-lint is available inside the majority of the package managers.
|
||||||
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
|
||||||
```
|
|
||||||
|
|
||||||
Preserving cache between consecutive runs:
|
### MacOS
|
||||||
```sh
|
|
||||||
docker run --rm -v $(pwd):/app -v ~/.cache/golangci-lint/{.LatestVersion}:/root/.cache -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
|
||||||
```
|
|
||||||
|
|
||||||
Colored output:
|
|
||||||
```sh
|
|
||||||
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
|
||||||
```
|
|
||||||
|
|
||||||
### macOS
|
|
||||||
|
|
||||||
#### Brew
|
#### Brew
|
||||||
|
|
||||||
@ -123,6 +114,22 @@ scoop install main/golangci-lint
|
|||||||
|
|
||||||
The scoop package is not officially maintained by golangci team.
|
The scoop package is not officially maintained by golangci team.
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
||||||
|
```
|
||||||
|
|
||||||
|
Preserving cache between consecutive runs:
|
||||||
|
```sh
|
||||||
|
docker run --rm -v $(pwd):/app -v ~/.cache/golangci-lint/{.LatestVersion}:/root/.cache -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
||||||
|
```
|
||||||
|
|
||||||
|
Colored output:
|
||||||
|
```sh
|
||||||
|
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
|
||||||
|
```
|
||||||
|
|
||||||
### Install from Source
|
### Install from Source
|
||||||
|
|
||||||
Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation.
|
Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation.
|
||||||
|
@ -26,7 +26,7 @@ There is a [plugin](https://github.com/SublimeLinter/SublimeLinter-golangcilint)
|
|||||||
|
|
||||||
How to configure:
|
How to configure:
|
||||||
|
|
||||||
- Install [plugin](https://plugins.jetbrains.com/plugin/12496-go-linter)
|
- Install [plugin](https://plugins.jetbrains.com/plugin/12496-go-linter).
|
||||||
- Add [File Watcher](https://www.jetbrains.com/help/go/settings-tools-file-watchers.html) using existing `golangci-lint` template.
|
- Add [File Watcher](https://www.jetbrains.com/help/go/settings-tools-file-watchers.html) using existing `golangci-lint` template.
|
||||||
- If your version of GoLand does not have the `golangci-lint` [File Watcher](https://www.jetbrains.com/help/go/settings-tools-file-watchers.html) template you can configure your own and use arguments `run --disable=typecheck $FileDir$`.
|
- If your version of GoLand does not have the `golangci-lint` [File Watcher](https://www.jetbrains.com/help/go/settings-tools-file-watchers.html) template you can configure your own and use arguments `run --disable=typecheck $FileDir$`.
|
||||||
|
|
||||||
@ -35,15 +35,18 @@ How to configure:
|
|||||||
There are available plugins:
|
There are available plugins:
|
||||||
|
|
||||||
- [Spacemacs](https://github.com/syl20bnr/spacemacs/blob/develop/layers/+lang/go/README.org#linting)
|
- [Spacemacs](https://github.com/syl20bnr/spacemacs/blob/develop/layers/+lang/go/README.org#linting)
|
||||||
- [flycheck checker](https://github.com/weijiangan/flycheck-golangci-lint).
|
- [Flycheck checker](https://github.com/weijiangan/flycheck-golangci-lint)
|
||||||
|
|
||||||
### Vim
|
### Vim
|
||||||
|
|
||||||
The following plugins support `golangci-lint`:
|
The following plugins support `golangci-lint`:
|
||||||
|
|
||||||
- [vim-go](https://github.com/fatih/vim-go);
|
- [vim-go](https://github.com/fatih/vim-go)
|
||||||
- [ALE](https://github.com/w0rp/ale);
|
- [ALE](https://github.com/w0rp/ale)
|
||||||
- [Syntastic](https://github.com/vim-syntastic/syntastic).
|
|
||||||
|
### LSP Server
|
||||||
|
|
||||||
|
- [golangci-lint-langserver](https://github.com/nametake/golangci-lint-langserver) (NeoVim, Vim, Emacs, ...)
|
||||||
|
|
||||||
## Shell Completion
|
## Shell Completion
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user