Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
66883b5fcf | |||
8ea3043ee4 | |||
95f6eefffa | |||
977a01f96c | |||
13e2c1f984 |
12
README.md
12
README.md
@ -2,9 +2,10 @@
|
||||
|
||||
[](https://github.com/golangci/golangci-lint-action/actions)
|
||||
|
||||

|
||||
It's the official GitHub action for [golangci-lint](https://github.com/golangci/golangci-lint) from it's authors.
|
||||
The action runs [golangci-lint](https://github.com/golangci/golangci-lint) and reports issues from linters.
|
||||
|
||||
The action that runs [golangci-lint](https://github.com/golangci/golangci-lint) and reports issues from linters.
|
||||

|
||||
|
||||
## How to use
|
||||
|
||||
@ -57,6 +58,13 @@ The action was implemented with performance in mind:
|
||||
2. We don't use Docker because image pulling is slow.
|
||||
3. We do as much as we can in parallel, e.g. we download cache, go and golangci-lint binary in parallel.
|
||||
|
||||
For example, in a repository of [golangci-lint](https://github.com/golangci/golangci-lint) running this action without the cache takes 50s, but with cache takes 14s:
|
||||
* in parallel:
|
||||
* 13s to download Go
|
||||
* 4s to restore 50 MB of cache
|
||||
* 1s to find and install `golangci-lint`
|
||||
* 1s to run `golangci-lint` (it takes 35s without cache)
|
||||
|
||||
## Internals
|
||||
|
||||
We use JavaScript-based action. We don't use Docker-based action because:
|
||||
|
@ -19,5 +19,5 @@ runs:
|
||||
main: 'dist/run/index.js'
|
||||
post: 'dist/post_run/index.js'
|
||||
branding:
|
||||
icon: 'check-circle'
|
||||
color: 'blue'
|
||||
icon: 'shield'
|
||||
color: 'yellow'
|
||||
|
2
dist/post_run/index.js
vendored
2
dist/post_run/index.js
vendored
@ -27904,7 +27904,7 @@ function buildCacheKeys() {
|
||||
keys.push(cacheKey);
|
||||
if (yield pathExists(`go.mod`)) {
|
||||
// Add checksum to key to invalidate a cache when dependencies change.
|
||||
cacheKey += yield checksumFile(`cache-key`, `go.mod`);
|
||||
cacheKey += yield checksumFile(`sha1`, `go.mod`);
|
||||
}
|
||||
else {
|
||||
cacheKey += `nogomod`;
|
||||
|
2
dist/run/index.js
vendored
2
dist/run/index.js
vendored
@ -27916,7 +27916,7 @@ function buildCacheKeys() {
|
||||
keys.push(cacheKey);
|
||||
if (yield pathExists(`go.mod`)) {
|
||||
// Add checksum to key to invalidate a cache when dependencies change.
|
||||
cacheKey += yield checksumFile(`cache-key`, `go.mod`);
|
||||
cacheKey += yield checksumFile(`sha1`, `go.mod`);
|
||||
}
|
||||
else {
|
||||
cacheKey += `nogomod`;
|
||||
|
3
go.mod
Normal file
3
go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/golangci/golangci-lint-action
|
||||
|
||||
go 1.14
|
@ -42,7 +42,7 @@ async function buildCacheKeys(): Promise<string[]> {
|
||||
|
||||
if (await pathExists(`go.mod`)) {
|
||||
// Add checksum to key to invalidate a cache when dependencies change.
|
||||
cacheKey += await checksumFile(`cache-key`, `go.mod`)
|
||||
cacheKey += await checksumFile(`sha1`, `go.mod`)
|
||||
} else {
|
||||
cacheKey += `nogomod`
|
||||
}
|
||||
|
Reference in New Issue
Block a user