Skip to content

Commit 463389c

Browse files
authored
docs: split install page (#6256)
1 parent 462163b commit 463389c

File tree

7 files changed

+102
-102
lines changed

7 files changed

+102
-102
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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
## Buildkite
40+
41+
Buildkite provides a [plugin](https://buildkite.com/resources/plugins/buildkite-plugins/golangci-lint-buildkite-plugin/) for running golangci-lint in Buildkite pipelines.
42+
43+
It utilizes the [Docker image of golangci-lint](/docs/welcome/install/local/#docker) by default, but can be set to use a binary if available on the agent.
44+
45+
The plugin will annotate builds with results, providing an easily readable summary of fixes.
46+
47+
```yaml {filename=".pipeline.yml"}
48+
plugins:
49+
- golangci-lint#v1.0.0:
50+
config: .golangci.yml
51+
```
52+
53+
## Other CI
54+
55+
Here are the other ways to install golangci-lint:
56+
57+
{{< cards >}}
58+
{{< card link="/docs/welcome/install/local/#binaries" title="Bash/Binaries" icon="archive" >}}
59+
{{< card link="/docs/welcome/install/local/#docker" title="Docker" icon="archive" >}}
60+
{{< /cards >}}

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

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

8-
## CI installation
6+
## Linux
97

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-
### Buildkite
46-
47-
Buildkite offers a [plugin](https://buildkite.com/resources/plugins/buildkite-plugins/golangci-lint-buildkite-plugin/) for running golangci-lint in Buildkite pipelines.
48-
49-
It utilizes the official [Docker image](https://hub.docker.com/r/golangci/golangci-lint) by default, but can be set to use a binary if available on the agent.
50-
51-
The plugin will annotate builds with results, providing an easily readable summary of fixes.
52-
53-
```yaml {filename=".pipeline.yml"}
54-
plugins:
55-
- golangci-lint#v1.0.0:
56-
config: .golangci.yml
57-
```
58-
59-
### Other CI
60-
61-
Here is the other way to install golangci-lint:
62-
63-
```bash
64-
# binary will be $(go env GOPATH)/bin/golangci-lint
65-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {{< golangci/latest-version >}}
66-
67-
# or install it into ./bin/
68-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s {{< golangci/latest-version >}}
69-
70-
# In Alpine Linux (as it does not come with curl by default)
71-
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s {{< golangci/latest-version >}}
72-
73-
golangci-lint --version
74-
```
75-
76-
It is advised that you periodically update the version of golangci-lint as the project is under active development and is constantly being improved.
77-
For any problems with golangci-lint, check out recent [GitHub issues](https://github.com/golangci/golangci-lint/issues) and update if needed.
8+
Golangci-lint is available inside the majority of the package managers.
789

79-
## Local Installation
10+
{{% details closed="true" title="Packaging status" %}}
8011

8112
[![Packaging status](https://repology.org/badge/vertical-allrepos/golangci-lint.svg)](https://repology.org/project/golangci-lint/versions)
8213

83-
### Binaries
84-
85-
```bash
86-
# binary will be $(go env GOPATH)/bin/golangci-lint
87-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin {{< golangci/latest-version >}}
88-
89-
golangci-lint --version
90-
```
91-
92-
On Windows, you can run the above commands with Git Bash, which comes with [Git for Windows](https://git-scm.com/download/win).
93-
94-
### Linux
95-
96-
Golangci-lint is available inside the majority of the package managers.
14+
{{% /details %}}
9715

98-
### macOS
16+
## macOS
9917

100-
#### Homebrew
18+
### Homebrew
10119

10220
Note: Homebrew can use an unexpected version of Go to build the binary,
10321
so we recommend either using our binaries or ensuring the version of Go used to build.
@@ -120,7 +38,7 @@ brew tap golangci/tap
12038
brew install golangci/tap/golangci-lint
12139
```
12240

123-
#### MacPorts
41+
### MacPorts
12442

12543
It can also be installed through [MacPorts](https://www.macports.org/)
12644
The MacPorts installation mode is community-driven and not officially maintained by the golangci team.
@@ -129,17 +47,17 @@ The MacPorts installation mode is community-driven and not officially maintained
12947
sudo port install golangci-lint
13048
```
13149

132-
### Windows
50+
## Windows
13351

134-
#### Chocolatey
52+
### Chocolatey
13553

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

13856
```bash
13957
choco install golangci-lint
14058
```
14159

142-
#### Scoop
60+
### Scoop
14361

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

@@ -149,7 +67,9 @@ scoop install main/golangci-lint
14967

15068
The scoop package is not officially maintained by golangci team.
15169

152-
### Docker
70+
## Docker
71+
72+
The Docker image is available on [Docker Hub](https://hub.docker.com/r/golangci/golangci-lint).
15373

15474
```bash
15575
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{{< golangci/latest-version >}} golangci-lint run
@@ -170,7 +90,7 @@ docker run --rm -t -v $(pwd):/app -w /app \
17090
golangci/golangci-lint:{{< golangci/latest-version >}} golangci-lint run
17191
```
17292

173-
### Install from Sources
93+
## Install from Sources
17494

17595
> [!WARNING]
17696
> 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)