doc: improve installation section (#3610)

This commit is contained in:
Ludovic Fernandez 2023-02-18 12:32:57 +01:00 committed by GitHub
parent fe53ca0cd4
commit defde13179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,8 +44,38 @@ and is constantly being improved. For any problems with `golangci-lint`, check o
## Local Installation
### Binaries
```sh
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin {.LatestVersion}
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).
### 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
```
### macOS
Note: brew can use a non-expected version of Go to build the binary,
so we recommend either using our binaries or be sure of the version of Go used to build.
You can install a binary release on macOS using [brew](https://brew.sh/):
```sh
@ -69,33 +99,6 @@ The macports installation mode is community driven, and not officially maintaine
sudo port install golangci-lint
```
### 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
```
### Linux and Windows
```sh
# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin {.LatestVersion}
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).
### Install from Source
Note: such `go install`/`go get` installation aren't guaranteed to work. We recommend using binary installation.