Skip to content

Commit 0926dc3

Browse files
committed
docs: split install page
1 parent 7d53213 commit 0926dc3

File tree

7 files changed

+92
-72
lines changed

7 files changed

+92
-72
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ integrates with all major IDEs, and includes over a hundred linters.
1313

1414
## Install `golangci-lint`
1515

16-
- [On my machine](https://golangci-lint.run/docs/welcome/install/#local-installation);
17-
- [On CI/CD systems](https://golangci-lint.run/docs/welcome/install/#ci-installation).
16+
- [On my machine](https://golangci-lint.run/docs/welcome/install/local);
17+
- [On CI/CD systems](https://golangci-lint.run/docs/welcome/install/ci).
1818

1919
## Documentation
2020

docs/content/docs/welcome/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This quickstart guide provides step-by-step instructions to help you install, co
88
<!--more-->
99

1010
{{< cards >}}
11-
{{< card link="/docs/welcome/install/#local-installation" title="Local Installation" icon="archive" >}}
12-
{{< card link="/docs/welcome/install/#ci-installation" title="CI Installation" icon="archive" >}}
11+
{{< card link="/docs/welcome/install/local" title="Local Installation" icon="archive" >}}
12+
{{< card link="/docs/welcome/install/ci" title="CI Installation" icon="archive" >}}
1313
{{< card link="/docs/welcome/integrations/" title="Integrations" icon="sparkles" >}}
1414
{{< card link="/docs/welcome/quick-start/#linting" title="Quick Start: Linting" icon="fast-forward" >}}
1515
{{< card link="/docs/welcome/quick-start/#formatting" title="Quick Start: Formatting" icon="fast-forward" >}}

docs/content/docs/welcome/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ some linters and/or internal pieces of golangci-lint could need to be adapted to
1919

2020
Run golangci-lint in CI and check the exit code. If it's non-zero - fail the build.
2121

22-
See [how to properly install golangci-lint in CI](/docs/welcome/install/#ci-installation)
22+
See [how to properly install golangci-lint in CI](/docs/welcome/install/ci)
2323

2424
## golangci-lint doesn't work
2525

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Install"
3+
weight: 1
4+
aliases:
5+
- /welcome/install/
6+
---
7+
8+
Where do you want to install golangci-lint?
9+
10+
{{< cards >}}
11+
{{< card link="/docs/welcome/install/local" title="On my machine" icon="archive" >}}
12+
{{< card link="/docs/welcome/install/ci" title="On CI/CD systems" icon="archive" >}}
13+
{{< /cards >}}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "CI Installation"
3+
weight: 3
4+
---
5+
6+
It's important to have reproducible CI: don't start to fail all builds at the same time.
7+
With golangci-lint this can happen if you use option `linters.default: all` and a new linter is added
8+
or even without `linters.default: all` when one upstream linter is upgraded.
9+
10+
> [!IMPORTANT]
11+
> It's highly recommended installing a specific version of golangci-lint available on the [releases page](https://github.com/golangci/golangci-lint/releases).
12+
13+
## GitHub Actions
14+
15+
We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint-action) for running golangci-lint in CI for GitHub projects.
16+
17+
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside,
18+
and it can be much faster than the simple binary installation.
19+
20+
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).
21+
22+
{{< cards cols=2 >}}
23+
{{< golangci/image-card src="/images/colored-line-number.png" title="Console Output" >}}
24+
{{< golangci/image-card src="/images/annotations.png" title="Annotations" >}}
25+
{{< /cards >}}
26+
27+
## GitLab CI
28+
29+
GitLab provides a [guide for integrating golangci-lint into the Code Quality widget](https://docs.gitlab.com/ci/testing/code_quality/#golangci-lint).
30+
A simple quickstart is their [CI component](https://gitlab.com/explore/catalog/components/code-quality-oss/codequality-os-scanners-integration), which can be used like this:
31+
32+
```yaml {filename=".gitlab-ci.yml"}
33+
include:
34+
- component: $CI_SERVER_FQDN/components/code-quality-oss/codequality-os-scanners-integration/golangci@1.0.1
35+
```
36+
37+
Note that you [can only reference components in the same GitLab instance as your project](https://docs.gitlab.com/ci/components/#use-a-component)
38+
39+
## Other CI
40+
41+
Here are the other ways to install golangci-lint:
42+
43+
{{< cards >}}
44+
{{< card link="/docs/welcome/install/local/#binaries" title="Bash/Binaries" icon="archive" >}}
45+
{{< card link="/docs/welcome/install/local/#docker" title="Docker" icon="archive" >}}
46+
{{< /cards >}}
47+
48+

docs/content/docs/welcome/install.md renamed to docs/content/docs/welcome/install/local.md

Lines changed: 18 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,9 @@
11
---
2-
title: "Install"
3-
weight: 1
4-
aliases:
5-
- /welcome/install/
2+
title: "Local Installation"
3+
weight: 2
64
---
75

8-
## CI installation
9-
10-
Most installations of golangci-lint are performed for CI.
11-
12-
It's important to have reproducible CI: don't start to fail all builds at the same time.
13-
With golangci-lint this can happen if you use option `linters.default: all` and a new linter is added
14-
or even without `linters.default: all` when one upstream linter is upgraded.
15-
16-
> [!IMPORTANT]
17-
> It's highly recommended installing a specific version of golangci-lint available on the [releases page](https://github.com/golangci/golangci-lint/releases).
18-
19-
### GitHub Actions
20-
21-
We recommend using [our GitHub Action](https://github.com/golangci/golangci-lint-action) for running golangci-lint in CI for GitHub projects.
22-
23-
It's [fast and uses smart caching](https://github.com/golangci/golangci-lint-action#performance) inside,
24-
and it can be much faster than the simple binary installation.
25-
26-
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).
27-
28-
{{< cards cols=2 >}}
29-
{{< golangci/image-card src="/images/colored-line-number.png" title="Console Output" >}}
30-
{{< golangci/image-card src="/images/annotations.png" title="Annotations" >}}
31-
{{< /cards >}}
32-
33-
### GitLab CI
34-
35-
GitLab provides a [guide for integrating golangci-lint into the Code Quality widget](https://docs.gitlab.com/ci/testing/code_quality/#golangci-lint).
36-
A simple quickstart is their [CI component](https://gitlab.com/explore/catalog/components/code-quality-oss/codequality-os-scanners-integration), which can be used like this:
37-
38-
```yaml {filename=".gitlab-ci.yml"}
39-
include:
40-
- component: $CI_SERVER_FQDN/components/code-quality-oss/codequality-os-scanners-integration/golangci@1.0.1
41-
```
42-
43-
Note that you [can only reference components in the same GitLab instance as your project](https://docs.gitlab.com/ci/components/#use-a-component)
44-
45-
### Other CI
46-
47-
Here is the other way to install golangci-lint:
6+
## Binaries
487

498
```bash
509
# binary will be $(go env GOPATH)/bin/golangci-lint
@@ -59,31 +18,24 @@ wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/insta
5918
golangci-lint --version
6019
```
6120

21+
On Windows, you can run the above commands with Git Bash, which comes with [Git for Windows](https://git-scm.com/download/win).
22+
6223
It is advised that you periodically update the version of golangci-lint as the project is under active development and is constantly being improved.
6324
For any problems with golangci-lint, check out recent [GitHub issues](https://github.com/golangci/golangci-lint/issues) and update if needed.
6425

65-
## Local Installation
66-
67-
[![Packaging status](https://repology.org/badge/vertical-allrepos/golangci-lint.svg)](https://repology.org/project/golangci-lint/versions)
68-
69-
### Binaries
70-
71-
```bash
72-
# binary will be $(go env GOPATH)/bin/golangci-lint
73-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {{< golangci/latest-version >}}
26+
## Linux
7427

75-
golangci-lint --version
76-
```
28+
Golangci-lint is available inside the majority of the package managers.
7729

78-
On Windows, you can run the above commands with Git Bash, which comes with [Git for Windows](https://git-scm.com/download/win).
30+
{{% details closed="true" title="Packaging status" %}}
7931

80-
### Linux
32+
[![Packaging status](https://repology.org/badge/vertical-allrepos/golangci-lint.svg)](https://repology.org/project/golangci-lint/versions)
8133

82-
Golangci-lint is available inside the majority of the package managers.
34+
{{% /details %}}
8335

84-
### macOS
36+
## macOS
8537

86-
#### Homebrew
38+
### Homebrew
8739

8840
Note: Homebrew can use an unexpected version of Go to build the binary,
8941
so we recommend either using our binaries or ensuring the version of Go used to build.
@@ -106,7 +58,7 @@ brew tap golangci/tap
10658
brew install golangci/tap/golangci-lint
10759
```
10860

109-
#### MacPorts
61+
### MacPorts
11062

11163
It can also be installed through [MacPorts](https://www.macports.org/)
11264
The MacPorts installation mode is community-driven and not officially maintained by the golangci team.
@@ -115,17 +67,17 @@ The MacPorts installation mode is community-driven and not officially maintained
11567
sudo port install golangci-lint
11668
```
11769

118-
### Windows
70+
## Windows
11971

120-
#### Chocolatey
72+
### Chocolatey
12173

12274
You can install a binary on Windows using [chocolatey](https://community.chocolatey.org/packages/golangci-lint).
12375

12476
```bash
12577
choco install golangci-lint
12678
```
12779

128-
#### Scoop
80+
### Scoop
12981

13082
You can install a binary on Windows using [scoop](https://scoop.sh).
13183

@@ -135,7 +87,7 @@ scoop install main/golangci-lint
13587

13688
The scoop package is not officially maintained by golangci team.
13789

138-
### Docker
90+
## Docker
13991

14092
```bash
14193
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{{< golangci/latest-version >}} golangci-lint run
@@ -156,7 +108,7 @@ docker run --rm -t -v $(pwd):/app -w /app \
156108
golangci/golangci-lint:{{< golangci/latest-version >}} golangci-lint run
157109
```
158110

159-
### Install from Sources
111+
## Install from Sources
160112

161113
> [!WARNING]
162114
> Using `go install`/`go get`, "tools pattern", and `tool` command/directives installations aren't guaranteed to work.

docs/layouts/_shortcodes/golangci/latest-version.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@
55
@example {{< golangci/latest-version >}}
66
*/ -}}
77

8-
{{- index $.Site.Data.version.version | default .Page.GitInfo.AbbreviatedHash | default "devel" -}}
8+
{{- $v := index $.Site.Data.version.version -}}
9+
{{- if $v -}}
10+
{{- $v -}}
11+
{{- else if .Page.GitInfo -}}
12+
{{- .Page.GitInfo.AbbreviatedCommit -}}
13+
{{- else -}}
14+
devel
15+
{{- end -}}

0 commit comments

Comments
 (0)