Compare commits
474 Commits
Author | SHA1 | Date | |
---|---|---|---|
3a91952989 | |||
5e676315e9 | |||
18dad33d2e | |||
945dc98b91 | |||
cac24f53b7 | |||
ab66454db6 | |||
a2527500a4 | |||
44d9998d44 | |||
b6bdfb3d14 | |||
c0cd965566 | |||
66268c5fbe | |||
2ab8c4423e | |||
2c52863893 | |||
77db3f966c | |||
797977b61a | |||
015f418198 | |||
88ae11c65f | |||
51e800db2c | |||
f05002851f | |||
b39364735e | |||
a657dba833 | |||
ba65924209 | |||
c0edea7835 | |||
a1145a6b27 | |||
83e5ccebf6 | |||
8457318a42 | |||
a422a812eb | |||
84836b13d8 | |||
360e5b76ee | |||
42ba3c24d6 | |||
4f5a3af221 | |||
f1690ab489 | |||
98d324947b | |||
5326fa0045 | |||
4d9aae64da | |||
d29c0cc90a | |||
28fa3382e3 | |||
715abd3467 | |||
01827479ce | |||
05fe2da5ec | |||
2a20098909 | |||
71a9ad5faf | |||
b814b8606f | |||
455ad55fab | |||
cde40a3b90 | |||
444727df93 | |||
aca98fe711 | |||
8078b42bbd | |||
1577f9c80c | |||
313d11ed7d | |||
907f20a45e | |||
639cd343e1 | |||
569abaa281 | |||
c57cc43669 | |||
322510a3ea | |||
185e7a2f8f | |||
5be60c708e | |||
825a50d3a2 | |||
8c13ec4e5d | |||
416b5d0b48 | |||
66a608006f | |||
f0ba586c1f | |||
b8fff06a27 | |||
5f1fec7010 | |||
601007b788 | |||
d2a913e97b | |||
7233bd71cb | |||
687f029324 | |||
f9990cd216 | |||
f30aa514f9 | |||
6b21f586ed | |||
535ed3a04b | |||
0078ef00ab | |||
776a285c4c | |||
0d51521d42 | |||
65ea3995bb | |||
653016502e | |||
4cb9697578 | |||
dd04c182af | |||
8c36daf744 | |||
0f97d97f47 | |||
27e48c2073 | |||
65466a27fa | |||
520b21135e | |||
369d614672 | |||
240da36b3d | |||
6897b1a051 | |||
4042cfe2d4 | |||
97bb55a183 | |||
744562230b | |||
1e0fb9b015 | |||
8bb781f27a | |||
c60079adbf | |||
f6781576ae | |||
c7b6fc977f | |||
579a4e6741 | |||
32a046958e | |||
7641ddf8a8 | |||
7261544346 | |||
b26535e6d1 | |||
e1c0a0543f | |||
2fdccc41f5 | |||
db0ea3f163 | |||
ed929be3ec | |||
76eaf57237 | |||
0fd20142bb | |||
3fc120753c | |||
8c99775d4b | |||
ea65405b36 | |||
7122616b22 | |||
39b10dd0d9 | |||
4593d99d2e | |||
30dacc8af6 | |||
464d9fd432 | |||
92ba55cf0d | |||
7cd2f0393b | |||
5077eeb6c1 | |||
d6d0cce229 | |||
e92337f3b6 | |||
bf4120ff3c | |||
61703f1af4 | |||
8b76d976da | |||
a2dc749409 | |||
aa94bc705d | |||
fdf641b40e | |||
12dfd24d9a | |||
01dfc8644b | |||
1ea20104d5 | |||
419d0912ea | |||
8c2f4f9823 | |||
4e6daa7065 | |||
ac77de69c2 | |||
7b2a3f3333 | |||
a904d1db61 | |||
6a290f7d5d | |||
97c6242097 | |||
5782ee83ad | |||
76503fda9a | |||
d36410f546 | |||
650217c0c5 | |||
a2a25205ce | |||
1aee3f97a3 | |||
c5c27dbc86 | |||
08e2f20817 | |||
8d110786c7 | |||
724a5425db | |||
ac0edcd804 | |||
d6404ce293 | |||
cb88bde406 | |||
f26018a9c0 | |||
78451d099c | |||
5570e66705 | |||
1626f2bd94 | |||
b56f6f5290 | |||
f1b2fc708e | |||
e697c2427a | |||
ffc5a07c17 | |||
fb9e2e0726 | |||
472a3ede4f | |||
c4655a9524 | |||
01dbfeed86 | |||
71abe3bf92 | |||
dbe755859c | |||
140f002bf8 | |||
4419fdcf2f | |||
e42fe74773 | |||
01e34dbcda | |||
59f1813dc5 | |||
5c9eb959d4 | |||
4479e05486 | |||
3b3229a7a5 | |||
6648f6197c | |||
64e94ebcda | |||
969dc8fc43 | |||
d6a52caa2e | |||
5284b3de3c | |||
d90ca1e16e | |||
6387738e0c | |||
391fb931f5 | |||
f680453377 | |||
c772a9ccc6 | |||
38adc9c883 | |||
f33e806949 | |||
f4ef9036d9 | |||
a64489f732 | |||
eafaf70f2d | |||
6b29c7a053 | |||
85f33ddfab | |||
d18b077279 | |||
f6938e6c8d | |||
0ad9a0988b | |||
235ea57a8f | |||
a6ed001163 | |||
3a7156a1b4 | |||
481f8ba892 | |||
06edb377a6 | |||
c2f79a722b | |||
d6eac69936 | |||
72684341c8 | |||
a926e2b3f3 | |||
07db5389c9 | |||
328c000029 | |||
3a79f8d45a | |||
43c645b597 | |||
88e5fc6380 | |||
6191de56c9 | |||
5423639e7b | |||
c225631afd | |||
b81d829cdb | |||
5b682fd40b | |||
3c6fb4a9a4 | |||
5acb063f68 | |||
08fdc050d7 | |||
b2bfd0f130 | |||
ef5f262671 | |||
a831c707bf | |||
9305be5e9f | |||
db74785593 | |||
4fbce4913d | |||
739eee4a65 | |||
bd7227e0c3 | |||
69982bc3b3 | |||
bda13fa868 | |||
c73fd3d91c | |||
deeca11946 | |||
ae667cb4ae | |||
419a536bfa | |||
1a17d0c27c | |||
4ed6524494 | |||
3edd9862e6 | |||
37d0148f78 | |||
90ccd72000 | |||
032fa5c5e4 | |||
b7bf60a5f7 | |||
ec5b0e19fc | |||
fd0768f916 | |||
3912a545cd | |||
6c4fff998e | |||
2856371066 | |||
beaa3476df | |||
05a61b80ab | |||
d5e3361cc5 | |||
c084df1245 | |||
954d4da58d | |||
4f42fc20b5 | |||
88a61333be | |||
42f1ace2dc | |||
e1a59558d0 | |||
60dc9d3648 | |||
5513777940 | |||
92e5575c87 | |||
6eab792f60 | |||
0445a18732 | |||
789454d92c | |||
0ae0217f51 | |||
565398b3aa | |||
2a9d271458 | |||
7dcc9e5fc3 | |||
422f985057 | |||
0db771b9ab | |||
5724191dd1 | |||
1ebc11120f | |||
7ee82f294a | |||
2de045bd7a | |||
fcb77afa4d | |||
0b542c7480 | |||
19d17f2de0 | |||
0335180c90 | |||
aae6024394 | |||
f016ec070e | |||
f8ba9f50be | |||
23255795fb | |||
1b63d697bd | |||
946a98c47e | |||
e837bc5a0c | |||
62870e168c | |||
421056684a | |||
451e84b610 | |||
1f5703370e | |||
7e8cc74dba | |||
bb2438c717 | |||
89600cb733 | |||
5c2b59ab34 | |||
c51d1e2f87 | |||
f3c064d740 | |||
6aefae24f7 | |||
537aa1903e | |||
f70e52dcc9 | |||
a304692ecb | |||
eeca7c5026 | |||
dfbcd2aee1 | |||
4421331437 | |||
5e6c1bb9e2 | |||
44eba43bae | |||
358a5e374f | |||
b9c65a53a1 | |||
9620ff9416 | |||
f973c7630e | |||
ac76264da2 | |||
b6b896c763 | |||
6d7c5c3914 | |||
df2c66cf29 | |||
f9d718302d | |||
c3ef0c3702 | |||
e498e7736a | |||
e1674c1af9 | |||
f233bcb89a | |||
4b237a63e5 | |||
af9f6d8b8e | |||
fb6358de51 | |||
226c5fce6f | |||
009d23987c | |||
6f887e018c | |||
5af63786ee | |||
128458b745 | |||
ca6bec4c75 | |||
042a8136fa | |||
827c06dc36 | |||
0105abc295 | |||
eb940f762b | |||
f9482e011a | |||
1e52a5d65c | |||
2a74a2a5c4 | |||
6ab5ae85b2 | |||
024aa36e22 | |||
f6cb2006aa | |||
b517f99ae2 | |||
9636c5bc97 | |||
03e4befc7a | |||
cdfc708aeb | |||
7d5614c3eb | |||
c675eb70db | |||
423fbafafc | |||
bcfc6f96bb | |||
d34ac2aef3 | |||
e4b538ed37 | |||
a288c0d3a6 | |||
b7a34f8320 | |||
129bcf9a1f | |||
153576c006 | |||
a9a9dff640 | |||
c5f5ea997d | |||
4a71b18a91 | |||
a4fdb6b72e | |||
ee1123f130 | |||
4ef1b2ec49 | |||
d218332866 | |||
f00c9148c4 | |||
f8f7d958bb | |||
bfc4fa1919 | |||
43be8d0cdd | |||
8067f9f84a | |||
f47759687a | |||
087e546081 | |||
5371bd590f | |||
24734036d2 | |||
21713123c6 | |||
9d1a680eed | |||
46a391f1c2 | |||
357a955e8e | |||
fce0498922 | |||
110e97717e | |||
1aecf21113 | |||
ef112b5be6 | |||
5125ed6d61 | |||
f05da40d4c | |||
a143bf8921 | |||
326fa87401 | |||
d2ac25d73f | |||
786003e9c7 | |||
62358f9da4 | |||
fe302dcadf | |||
c266032a10 | |||
d11c12cf90 | |||
959b4c2ca0 | |||
149c153930 | |||
1536a018c7 | |||
b436a39715 | |||
f8f6480e7d | |||
836191867d | |||
0559ce1d80 | |||
b88829864d | |||
b19e2b3c0a | |||
12240bc515 | |||
49b6acfed8 | |||
bab998e698 | |||
a832735f53 | |||
d36089f6c3 | |||
409e5d240e | |||
549764e76a | |||
f05cdc6faa | |||
a6989616e2 | |||
4f60444900 | |||
ac08543e75 | |||
75023663df | |||
4ff279027a | |||
31d144d116 | |||
15e20abff8 | |||
46f8c43497 | |||
14684a93ef | |||
0e9fa9c8e2 | |||
15ed67c1de | |||
caa1fa532d | |||
e62c1052cf | |||
caf7c34f5a | |||
7376bdf790 | |||
1f0d323737 | |||
a39c3ffed3 | |||
9a759fbc45 | |||
62e84c3c4c | |||
b25b8c7a74 | |||
bbd70929c2 | |||
60abaa8ea2 | |||
8c1e004312 | |||
6f6d8132f3 | |||
219bd32ab9 | |||
7ede1b4cda | |||
0117eff7bc | |||
06f6e1a8f1 | |||
df080e3b0c | |||
83f444df15 | |||
28e8ba14c9 | |||
087718c925 | |||
d1dab7c3b6 | |||
02697c5273 | |||
4deddfaddc | |||
932e5370e4 | |||
f6bac355f6 | |||
851656297a | |||
42fcadffd7 | |||
9110cf0ecc | |||
ea8f042b47 | |||
4603c8008d | |||
df58a55048 | |||
7cce37b0b4 | |||
fee05dc7f3 | |||
ce06d75c94 | |||
988235bf28 | |||
aa4608ff29 | |||
18265ba4d8 | |||
7bac37febb | |||
6dfbaa3535 | |||
54d492b16c | |||
27ed31ebd6 | |||
e027344f45 | |||
6d0159e91a | |||
4e7bbc596f | |||
6bfe1df230 | |||
8e3dd7cda3 | |||
d9309c3ecd | |||
27d36d540a | |||
15d9fe194e | |||
23ef4c9b80 | |||
ad3b558f83 | |||
b2f22d964b | |||
85a08b9006 | |||
2036e240da | |||
17d4bc397f | |||
c355eeab11 | |||
db69912a35 | |||
f14c093626 | |||
7f1a4282b7 | |||
0adb1986cf | |||
75ba1c2aad | |||
ac8bda106a | |||
1d44e6d1ee | |||
89fe568d08 | |||
c697566258 | |||
9ce9ed1016 | |||
3bb6112eb2 | |||
e4395de4fb | |||
52d77950b7 | |||
ebc78f9b2f | |||
835e616ef0 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
dist/** linguist-generated=true
|
73
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
73
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
name: Bug Report
|
||||
description: "Create a report to help us improve."
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Welcome
|
||||
options:
|
||||
- label: Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
|
||||
required: true
|
||||
- label: Yes, I've searched similar issues on GitHub and didn't find any.
|
||||
required: true
|
||||
- label: Yes, I've included all information below (version, config, etc).
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Description of the problem
|
||||
placeholder: Your problem description
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: golangci-lint-version
|
||||
attributes:
|
||||
label: Version of golangci-lint
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: github-action-version
|
||||
attributes:
|
||||
label: Version of the GitHub Action
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: config
|
||||
attributes:
|
||||
label: Workflow file
|
||||
value: |-
|
||||
<details>
|
||||
|
||||
```
|
||||
<add you file here>
|
||||
```
|
||||
|
||||
</details>
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: go-env
|
||||
attributes:
|
||||
label: Go version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: code-example
|
||||
attributes:
|
||||
label: Code example or link to a public repository
|
||||
value: |-
|
||||
<details>
|
||||
|
||||
```go
|
||||
// add your code here
|
||||
```
|
||||
|
||||
</details>
|
||||
validations:
|
||||
required: true
|
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
11
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Questions
|
||||
url: https://github.com/golangci/golangci-lint-action/discussions
|
||||
about: If you have a question, or are looking for advice, please post on our Discussions forum!
|
||||
- name: golangci-lint main repository
|
||||
url: https://github.com/golangci/golangci-lint
|
||||
about: The main repository of golangci-lint.
|
||||
- name: golangci-lint documentation
|
||||
url: https://golangci-lint.run
|
||||
about: Please take a look to our documentation.
|
44
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
44
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: Feature request
|
||||
description: "Suggest an idea for this project."
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Welcome
|
||||
options:
|
||||
- label: Yes, I understand that the GitHub action repository is not the repository of golangci-lint itself.
|
||||
required: true
|
||||
- label: Yes, I've searched similar issues on GitHub and didn't find any.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Your feature request related to a problem? Please describe.
|
||||
placeholder: "A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Describe the solution you'd like.
|
||||
placeholder: "A clear and concise description of what you want to happen."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Describe alternatives you've considered.
|
||||
placeholder: "A clear and concise description of any alternative solutions or features you've considered."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: additional
|
||||
attributes:
|
||||
label: Additional context.
|
||||
placeholder: "Add any other context or screenshots about the feature request here."
|
||||
validations:
|
||||
required: false
|
4
.github/dependabot.yml
vendored
4
.github/dependabot.yml
vendored
@ -4,11 +4,7 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
reviewers:
|
||||
- "golangci/team"
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
reviewers:
|
||||
- "golangci/team"
|
||||
|
15
.github/release.yml
vendored
Normal file
15
.github/release.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
changelog:
|
||||
categories:
|
||||
- title: Changes
|
||||
labels:
|
||||
- '*'
|
||||
exclude:
|
||||
labels:
|
||||
- documentation
|
||||
- dependencies
|
||||
- title: Documentation
|
||||
labels:
|
||||
- documentation
|
||||
- title: Dependencies
|
||||
labels:
|
||||
- dependencies
|
6
.github/workflows/codeql.yaml
vendored
6
.github/workflows/codeql.yaml
vendored
@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
# Must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head of the pull request.
|
||||
@ -31,7 +31,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@v2
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
language: 'javascript'
|
||||
@ -41,4 +41,4 @@ jobs:
|
||||
npm run all
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: github/codeql-action/analyze@v2
|
||||
|
82
.github/workflows/test.yml
vendored
82
.github/workflows/test.yml
vendored
@ -10,12 +10,39 @@ jobs:
|
||||
build: # make sure build/ci work properly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- if: ${{ !(github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))) }}
|
||||
uses: actions/checkout@v3
|
||||
- if: github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- run: |
|
||||
npm install
|
||||
npm run all
|
||||
|
||||
# Update dist files if there is label dependencies or pull request' author is dependabot[bot] (id = 49699333)
|
||||
- name: Update dist files
|
||||
if: github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))
|
||||
run: |
|
||||
if [[ -z $(git status -s) ]]
|
||||
then
|
||||
echo "No change is required"
|
||||
else
|
||||
echo "Updating dist directory"
|
||||
git config --local user.name "dependabot[bot]"
|
||||
git config --local user.email "49699333+dependabot[bot]@users.noreply.github.com"
|
||||
git add --update
|
||||
git commit --message="Update dist files"
|
||||
git push
|
||||
fi
|
||||
|
||||
# Fail the build if there is dirty change
|
||||
- run: git diff --exit-code
|
||||
|
||||
test: # make sure the action works on a clean machine without building
|
||||
needs: [ build ]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
@ -25,18 +52,54 @@ jobs:
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v1.37"
|
||||
- "v1.37.1"
|
||||
- "v1.53"
|
||||
- "v1.53.2"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
args: --issues-exit-code=0 ./sample/...
|
||||
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
||||
only-new-issues: true
|
||||
|
||||
test-go-install: # make sure the action works on a clean machine without building (go-install mode)
|
||||
needs: [ build ]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v1.53.2"
|
||||
- "b5093688c0d3008eaacd6066773a1a52e689252f"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
||||
only-new-issues: true
|
||||
install-mode: goinstall
|
||||
|
||||
test-go-mod-version:
|
||||
needs: [ build ]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
@ -44,9 +107,14 @@ jobs:
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
with:
|
||||
working-directory: sample-go-mod
|
||||
args: --issues-exit-code=0 ./...
|
||||
args: --timeout=5m --issues-exit-code=0 ./...
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -97,3 +97,6 @@ typings/
|
||||
|
||||
# Text editor files
|
||||
.vscode/
|
||||
|
||||
# IntelliJ/WebStorm files
|
||||
.idea
|
||||
|
84
README.md
84
README.md
@ -9,6 +9,8 @@ The action runs [golangci-lint](https://github.com/golangci/golangci-lint) and r
|
||||
|
||||
## Compatibility
|
||||
|
||||
* `v3.0.0+` requires explicit setup-go installation step prior to using this action: `uses: actions/setup-go@v3`.
|
||||
The `skip-go-installation` option has been removed.
|
||||
* `v2.0.0+` works with `golangci-lint` version >= `v1.28.3`
|
||||
* `v1.2.2` is deprecated due to we forgot to change the minimum version of `golangci-lint` to `v1.28.3` ([issue](https://github.com/golangci/golangci-lint-action/issues/39))
|
||||
* `v1.2.1` works with `golangci-lint` version >= `v1.14.0` ([issue](https://github.com/golangci/golangci-lint-action/issues/39))
|
||||
@ -21,41 +23,58 @@ Add `.github/workflows/golangci-lint.yml` with the following contents:
|
||||
name: golangci-lint
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
# Optional: allow read access to pull request. Use with `only-new-issues` option.
|
||||
# pull-requests: read
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||
version: v1.29
|
||||
go-version: '1.20'
|
||||
cache: false
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
# Require: The version of golangci-lint to use.
|
||||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
version: v1.53
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
|
||||
# Optional: golangci-lint command line arguments.
|
||||
# args: --issues-exit-code=0
|
||||
#
|
||||
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
|
||||
# The location of the configuration file can be changed by using `--config=`
|
||||
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||
|
||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||
# only-new-issues: true
|
||||
|
||||
# Optional: if set to true then the action will use pre-installed Go.
|
||||
# skip-go-installation: true
|
||||
# Optional: if set to true, then all caching functionality will be completely disabled,
|
||||
# takes precedence over all other caching options.
|
||||
# skip-cache: true
|
||||
|
||||
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
|
||||
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
|
||||
# skip-pkg-cache: true
|
||||
|
||||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
|
||||
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
|
||||
# skip-build-cache: true
|
||||
|
||||
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
|
||||
# install-mode: "goinstall"
|
||||
```
|
||||
|
||||
We recommend running this action in a job separate from other jobs (`go test`, etc)
|
||||
@ -69,35 +88,52 @@ If you need to run linters for specific operating systems, you will need to use
|
||||
name: golangci-lint
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
# Optional: allow read access to pull request. Use with `only-new-issues` option.
|
||||
# pull-requests: read
|
||||
|
||||
jobs:
|
||||
golangci:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.15.x]
|
||||
go: ['1.20']
|
||||
os: [macos-latest, windows-latest]
|
||||
name: lint
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||
version: v1.29
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: false
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
# Require: The version of golangci-lint to use.
|
||||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
version: v1.53
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
|
||||
# Optional: golangci-lint command line arguments.
|
||||
# args: --issues-exit-code=0
|
||||
#
|
||||
# Note: by default the `.golangci.yml` file should be at the root of the repository.
|
||||
# The location of the configuration file can be changed by using `--config=`
|
||||
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||
|
||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||
# only-new-issues: true
|
||||
|
||||
# Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
|
||||
# install-mode: "goinstall"
|
||||
```
|
||||
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for windows builds are properly formatted:
|
||||
@ -125,7 +161,6 @@ The action was implemented with performance in mind:
|
||||
|
||||
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)
|
||||
@ -145,16 +180,15 @@ Inside our action we perform 3 steps:
|
||||
* restore [cache](https://github.com/actions/cache) of previous analyzes
|
||||
* 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 (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)
|
||||
* install the latest Go 1.x version using [@actions/setup-go](https://github.com/actions/setup-go)
|
||||
2. Run `golangci-lint` with specified by user `args`
|
||||
3. Save cache for later builds
|
||||
|
||||
### Caching internals
|
||||
|
||||
1. We save and restore the following directories: `~/.cache/golangci-lint`, `~/.cache/go-build`, `~/go/pkg`.
|
||||
2. The primary caching key looks like `golangci-lint.cache-{platform-arch}-{interval_number}-{go.mod_hash}`. Interval number ensures that we periodically invalidate
|
||||
2. The primary caching key looks like `golangci-lint.cache-{interval_number}-{go.mod_hash}`. Interval number ensures that we periodically invalidate
|
||||
our cache (every 7 days). `go.mod` hash ensures that we invalidate the cache early - as soon as dependencies have changed.
|
||||
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}-`, `golangci-lint.cache-`. GitHub matches keys by prefix if we have no exact match for the primary cache.
|
||||
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.
|
||||
|
||||
This scheme is basic and needs improvements. Pull requests and ideas are welcome.
|
||||
|
||||
|
39
action.yml
39
action.yml
@ -3,7 +3,10 @@ description: "Official golangci-lint action with line-attached annotations for f
|
||||
author: "golangci"
|
||||
inputs:
|
||||
version:
|
||||
description: "version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version"
|
||||
description: |
|
||||
The version of golangci-lint to use.
|
||||
When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||
When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
required: false
|
||||
args:
|
||||
description: "golangci-lint command line arguments"
|
||||
@ -15,25 +18,31 @@ inputs:
|
||||
github-token:
|
||||
description: "the token is used for fetching patch of a pull request to show only new issues"
|
||||
default: ${{ github.token }}
|
||||
required: true
|
||||
required: false
|
||||
only-new-issues:
|
||||
description: "if set to true and the action runs on a pull request - the action outputs only newly found issues"
|
||||
default: false
|
||||
required: true
|
||||
skip-go-installation:
|
||||
description: "if set to true then action uses pre-installed Go"
|
||||
default: false
|
||||
required: true
|
||||
default: 'false'
|
||||
required: false
|
||||
skip-cache:
|
||||
description: |
|
||||
if set to true then the all caching functionality will be complete disabled,
|
||||
takes precedence over all other caching options.
|
||||
default: 'false'
|
||||
required: false
|
||||
skip-pkg-cache:
|
||||
description: "if set to true then the action don't cache or restore ~/go/pkg."
|
||||
default: false
|
||||
required: true
|
||||
description: "if set to true then the action doesn't cache or restore ~/go/pkg."
|
||||
default: 'false'
|
||||
required: false
|
||||
skip-build-cache:
|
||||
description: "if set to true then the action don't cache or restore ~/.cache/go-build."
|
||||
default: false
|
||||
required: true
|
||||
description: "if set to true then the action doesn't cache or restore ~/.cache/go-build."
|
||||
default: 'false'
|
||||
required: false
|
||||
install-mode:
|
||||
description: "The mode to install golangci-lint. It can be 'binary' or 'goinstall'."
|
||||
default: "binary"
|
||||
required: false
|
||||
runs:
|
||||
using: "node12"
|
||||
using: "node16"
|
||||
main: "dist/run/index.js"
|
||||
post: "dist/post_run/index.js"
|
||||
branding:
|
||||
|
119229
dist/post_run/index.js
generated
vendored
119229
dist/post_run/index.js
generated
vendored
File diff suppressed because one or more lines are too long
119229
dist/run/index.js
generated
vendored
119229
dist/run/index.js
generated
vendored
File diff suppressed because one or more lines are too long
6350
package-lock.json
generated
6350
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
45
package.json
45
package.json
@ -1,12 +1,10 @@
|
||||
{
|
||||
"name": "golanci-lint-action",
|
||||
"version": "2.0.0",
|
||||
"version": "3.1.0",
|
||||
"private": true,
|
||||
"description": "golangci-lint github action",
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
"prepare-setup-go": "cd node_modules/setup-go && npm run build",
|
||||
"prepare-deps": "npm run prepare-setup-go",
|
||||
"build": "tsc && ncc build -o dist/run/ src/main.ts && ncc build -o dist/post_run/ src/post_main.ts",
|
||||
"watched_build_main": "tsc && ncc build -w -o dist/run/ src/main.ts",
|
||||
"watched_build_post_main": "tsc && ncc build -w -o dist/post_run/ src/post_main.ts",
|
||||
@ -15,7 +13,7 @@
|
||||
"lint-fix": "eslint **/*.ts --cache --fix",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"all": "npm run prepare-deps && npm run build && npm run format-check && npm run lint",
|
||||
"all": "npm run build && npm run format-check && npm run lint",
|
||||
"local": "npm run build && act -j test -b",
|
||||
"local-full-version": "npm run build && act -j test-full-version -b"
|
||||
},
|
||||
@ -26,28 +24,27 @@
|
||||
"author": "golangci",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^1.0.6",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@actions/tool-cache": "^1.6.1",
|
||||
"@types/semver": "^7.3.4",
|
||||
"@types/tmp": "^0.2.0",
|
||||
"setup-go": "git+https://github.com/actions/setup-go.git#v2.1.3",
|
||||
"@actions/cache": "^3.2.2",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^5.1.1",
|
||||
"@actions/http-client": "^2.1.1",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@types/node": "^20.5.0",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@types/tmp": "^0.2.3",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.37",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.19.0",
|
||||
"@typescript-eslint/parser": "^4.19.0",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^7.23.0",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||
"prettier": "^2.2.1",
|
||||
"typescript": "^4.2.3"
|
||||
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
||||
"@typescript-eslint/parser": "^6.3.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"prettier": "^3.0.1",
|
||||
"typescript": "^5.1.6"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,179 @@
|
||||
module sample
|
||||
|
||||
go 1.15
|
||||
go 1.19
|
||||
|
||||
require github.com/golangci/golangci-lint v1.37.1
|
||||
require github.com/golangci/golangci-lint v1.51.2
|
||||
|
||||
require (
|
||||
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
|
||||
4d63.com/gochecknoglobals v0.2.1 // indirect
|
||||
github.com/Abirdcfly/dupword v0.0.9 // indirect
|
||||
github.com/Antonboom/errname v0.1.7 // indirect
|
||||
github.com/Antonboom/nilnil v0.1.1 // indirect
|
||||
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/OpenPeeDeeP/depguard v1.1.1 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/alingse/asasalint v0.0.11 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.4.0 // indirect
|
||||
github.com/ashanbrown/makezero v1.1.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.0 // indirect
|
||||
github.com/blizzy78/varnamelen v0.8.0 // indirect
|
||||
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
|
||||
github.com/breml/bidichk v0.2.3 // indirect
|
||||
github.com/breml/errchkjson v0.3.0 // indirect
|
||||
github.com/butuzov/ireturn v0.1.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/charithe/durationcheck v0.0.9 // indirect
|
||||
github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect
|
||||
github.com/curioswitch/go-reassign v0.2.0 // indirect
|
||||
github.com/daixiang0/gci v0.9.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.4.3 // indirect
|
||||
github.com/esimonov/ifshort v1.0.4 // indirect
|
||||
github.com/ettle/strcase v0.1.1 // indirect
|
||||
github.com/fatih/color v1.14.1 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
github.com/go-critic/go-critic v0.6.7 // indirect
|
||||
github.com/go-toolsmith/astcast v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.0.3 // indirect
|
||||
github.com/go-toolsmith/astequal v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astfmt v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astp v1.1.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.1.0 // indirect
|
||||
github.com/go-toolsmith/typep v1.1.0 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
|
||||
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2 // indirect
|
||||
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
|
||||
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
|
||||
github.com/golangci/misspell v0.4.0 // indirect
|
||||
github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.4.2 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hexops/gotextdiff v1.0.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.1 // indirect
|
||||
github.com/jgautheron/goconst v1.5.1 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
|
||||
github.com/julz/importas v0.1.0 // indirect
|
||||
github.com/junk1tm/musttag v0.4.5 // indirect
|
||||
github.com/kisielk/errcheck v1.6.3 // indirect
|
||||
github.com/kisielk/gotool v1.0.0 // indirect
|
||||
github.com/kkHAIKE/contextcheck v1.1.3 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.6 // indirect
|
||||
github.com/kyoh86/exportloopref v0.1.11 // indirect
|
||||
github.com/ldez/gomoddirectives v0.2.3 // indirect
|
||||
github.com/ldez/tagliatelle v0.4.0 // indirect
|
||||
github.com/leonklingele/grouper v1.1.1 // indirect
|
||||
github.com/lufeee/execinquery v1.2.1 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/maratori/testableexamples v1.0.0 // indirect
|
||||
github.com/maratori/testpackage v1.1.0 // indirect
|
||||
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.9 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
|
||||
github.com/mgechev/revive v1.2.5 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/moricho/tparallel v0.2.1 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
|
||||
github.com/nishanths/exhaustive v0.9.5 // indirect
|
||||
github.com/nishanths/predeclared v0.2.2 // indirect
|
||||
github.com/nunnatsa/ginkgolinter v0.8.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/polyfloyd/go-errorlint v1.1.0 // indirect
|
||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.3.19 // indirect
|
||||
github.com/quasilyte/gogrep v0.5.0 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.3.0 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.4.0 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.23.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.15.0 // indirect
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/sivchari/containedctx v1.0.2 // indirect
|
||||
github.com/sivchari/nosnakecase v1.7.0 // indirect
|
||||
github.com/sivchari/tenv v1.7.1 // indirect
|
||||
github.com/sonatard/noctx v0.0.1 // indirect
|
||||
github.com/sourcegraph/go-diff v0.7.0 // indirect
|
||||
github.com/spf13/afero v1.8.2 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/cobra v1.6.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.12.0 // indirect
|
||||
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
|
||||
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/stretchr/testify v1.8.1 // indirect
|
||||
github.com/subosito/gotenv v1.4.1 // indirect
|
||||
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
|
||||
github.com/tdakkota/asciicheck v0.1.1 // indirect
|
||||
github.com/tetafro/godot v1.4.11 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e // indirect
|
||||
github.com/timonwong/loggercheck v0.9.3 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.8.0 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
|
||||
github.com/ultraware/funlen v0.0.3 // indirect
|
||||
github.com/ultraware/whitespace v0.0.5 // indirect
|
||||
github.com/uudashr/gocognit v1.0.6 // indirect
|
||||
github.com/yagipy/maintidx v1.0.0 // indirect
|
||||
github.com/yeya24/promlinter v0.2.0 // indirect
|
||||
gitlab.com/bosi/decorder v0.2.3 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.17.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect
|
||||
golang.org/x/mod v0.8.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.6.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
honnef.co/go/tools v0.4.2 // indirect
|
||||
mvdan.cc/gofumpt v0.4.0 // indirect
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
|
||||
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect
|
||||
)
|
||||
|
1019
sample-go-mod/go.sum
1019
sample-go-mod/go.sum
File diff suppressed because it is too large
Load Diff
19
src/cache.ts
19
src/cache.ts
@ -52,17 +52,18 @@ const getIntervalKey = (invalidationIntervalDays: number): string => {
|
||||
|
||||
async function buildCacheKeys(): Promise<string[]> {
|
||||
const keys = []
|
||||
let cacheKey = `golangci-lint.cache-`
|
||||
keys.push(cacheKey)
|
||||
|
||||
// Periodically invalidate a cache because a new code being added.
|
||||
// TODO: configure it via inputs.
|
||||
cacheKey += `${getIntervalKey(7)}-`
|
||||
let cacheKey = `golangci-lint.cache-${getIntervalKey(7)}-`
|
||||
keys.push(cacheKey)
|
||||
|
||||
if (await pathExists(`go.mod`)) {
|
||||
// Get working directory from input
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
// create path to go.mod prepending the workingDirectory if it exists
|
||||
const goModPath = path.join(workingDirectory, `go.mod`)
|
||||
core.info(`Checking for go.mod: ${goModPath}`)
|
||||
if (await pathExists(goModPath)) {
|
||||
// Add checksum to key to invalidate a cache when dependencies change.
|
||||
cacheKey += await checksumFile(`sha1`, `go.mod`)
|
||||
cacheKey += await checksumFile(`sha1`, goModPath)
|
||||
} else {
|
||||
cacheKey += `nogomod`
|
||||
}
|
||||
@ -72,6 +73,8 @@ async function buildCacheKeys(): Promise<string[]> {
|
||||
}
|
||||
|
||||
export async function restoreCache(): Promise<void> {
|
||||
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
|
||||
|
||||
if (!utils.isValidEvent()) {
|
||||
utils.logWarning(
|
||||
`Event Validation Error: The event type ${process.env[Events.Key]} is not supported because it's not tied to a branch or tag ref.`
|
||||
@ -112,6 +115,8 @@ export async function restoreCache(): Promise<void> {
|
||||
}
|
||||
|
||||
export async function saveCache(): Promise<void> {
|
||||
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
|
||||
|
||||
// Validate inputs, this can cause task failure
|
||||
if (!utils.isValidEvent()) {
|
||||
utils.logWarning(
|
||||
|
4
src/deps.d.ts
vendored
4
src/deps.d.ts
vendored
@ -1,7 +1,3 @@
|
||||
declare module "setup-go/lib/main" {
|
||||
function run(): Promise<void>
|
||||
}
|
||||
|
||||
declare module "cache/lib/restore" {
|
||||
function run(): Promise<void>
|
||||
export default run
|
||||
|
108
src/install.ts
108
src/install.ts
@ -1,11 +1,14 @@
|
||||
import * as core from "@actions/core"
|
||||
import * as tc from "@actions/tool-cache"
|
||||
import { exec, ExecOptions } from "child_process"
|
||||
import os from "os"
|
||||
import path from "path"
|
||||
import { run as setupGo } from "setup-go/lib/main"
|
||||
import { promisify } from "util"
|
||||
|
||||
import { VersionConfig } from "./version"
|
||||
|
||||
const execShellCommand = promisify(exec)
|
||||
|
||||
const downloadURL = "https://github.com/golangci/golangci-lint/releases/download"
|
||||
|
||||
const getAssetURL = (versionConfig: VersionConfig): string => {
|
||||
@ -32,13 +35,95 @@ const getAssetURL = (versionConfig: VersionConfig): string => {
|
||||
return `${downloadURL}/${versionConfig.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}`
|
||||
}
|
||||
|
||||
// The installLint returns path to installed binary of golangci-lint.
|
||||
export async function installLint(versionConfig: VersionConfig): Promise<string> {
|
||||
export enum InstallMode {
|
||||
Binary = "binary",
|
||||
GoInstall = "goinstall",
|
||||
}
|
||||
|
||||
type ExecRes = {
|
||||
stdout: string
|
||||
stderr: string
|
||||
}
|
||||
|
||||
const printOutput = (res: ExecRes): void => {
|
||||
if (res.stdout) {
|
||||
core.info(res.stdout)
|
||||
}
|
||||
if (res.stderr) {
|
||||
core.info(res.stderr)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install golangci-lint.
|
||||
*
|
||||
* @param versionConfig information about version to install.
|
||||
* @param mode installation mode.
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
export async function installLint(versionConfig: VersionConfig, mode: InstallMode): Promise<string> {
|
||||
core.info(`Installation mode: ${mode}`)
|
||||
|
||||
switch (mode) {
|
||||
case InstallMode.Binary:
|
||||
return installBin(versionConfig)
|
||||
case InstallMode.GoInstall:
|
||||
return goInstall(versionConfig)
|
||||
default:
|
||||
return installBin(versionConfig)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install golangci-lint via `go install`.
|
||||
*
|
||||
* @param versionConfig information about version to install.
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
export async function goInstall(versionConfig: VersionConfig): Promise<string> {
|
||||
core.info(`Installing golangci-lint ${versionConfig.TargetVersion}...`)
|
||||
|
||||
const startedAt = Date.now()
|
||||
|
||||
const options: ExecOptions = { env: { ...process.env, CGO_ENABLED: "1" } }
|
||||
|
||||
const exres = await execShellCommand(
|
||||
`go install github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`,
|
||||
options
|
||||
)
|
||||
printOutput(exres)
|
||||
|
||||
const res = await execShellCommand(
|
||||
`go install -n github.com/golangci/golangci-lint/cmd/golangci-lint@${versionConfig.TargetVersion}`,
|
||||
options
|
||||
)
|
||||
printOutput(res)
|
||||
|
||||
// The output of `go install -n` when the binary is already installed is `touch <path_to_the_binary>`.
|
||||
const lintPath = res.stderr.trimStart().trimEnd().split(` `, 2)[1]
|
||||
|
||||
core.info(`Installed golangci-lint into ${lintPath} in ${Date.now() - startedAt}ms`)
|
||||
|
||||
return lintPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Install golangci-lint via the precompiled binary.
|
||||
*
|
||||
* @param versionConfig information about version to install.
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
export async function installBin(versionConfig: VersionConfig): Promise<string> {
|
||||
core.info(`Installing golangci-lint binary ${versionConfig.TargetVersion}...`)
|
||||
|
||||
const startedAt = Date.now()
|
||||
|
||||
const assetURL = getAssetURL(versionConfig)
|
||||
core.info(`Downloading ${assetURL} ...`)
|
||||
|
||||
core.info(`Downloading binary ${assetURL} ...`)
|
||||
|
||||
const archivePath = await tc.downloadTool(assetURL)
|
||||
|
||||
let extractedDir = ""
|
||||
let repl = /\.tar\.gz$/
|
||||
if (assetURL.endsWith("zip")) {
|
||||
@ -56,19 +141,8 @@ export async function installLint(versionConfig: VersionConfig): Promise<string>
|
||||
const urlParts = assetURL.split(`/`)
|
||||
const dirName = urlParts[urlParts.length - 1].replace(repl, ``)
|
||||
const lintPath = path.join(extractedDir, dirName, `golangci-lint`)
|
||||
|
||||
core.info(`Installed golangci-lint into ${lintPath} in ${Date.now() - startedAt}ms`)
|
||||
|
||||
return lintPath
|
||||
}
|
||||
|
||||
export async function installGo(): Promise<void> {
|
||||
const skipGoInstallation = core.getInput(`skip-go-installation`, { required: true }).trim()
|
||||
if (skipGoInstallation.toLowerCase() == "true") {
|
||||
core.info(`Skipping the installation of Go`)
|
||||
return
|
||||
}
|
||||
|
||||
const startedAt = Date.now()
|
||||
process.env[`INPUT_GO-VERSION`] = `1`
|
||||
await setupGo()
|
||||
core.info(`Installed Go in ${Date.now() - startedAt}ms`)
|
||||
}
|
||||
|
62
src/run.ts
62
src/run.ts
@ -7,7 +7,8 @@ import { dir } from "tmp"
|
||||
import { promisify } from "util"
|
||||
|
||||
import { restoreCache, saveCache } from "./cache"
|
||||
import { installGo, installLint } from "./install"
|
||||
import { installLint, InstallMode } from "./install"
|
||||
import { alterDiffPatch } from "./utils/diffUtils"
|
||||
import { findLintVersion } from "./version"
|
||||
|
||||
const execShellCommand = promisify(exec)
|
||||
@ -15,8 +16,10 @@ const writeFile = promisify(fs.writeFile)
|
||||
const createTempDir = promisify(dir)
|
||||
|
||||
async function prepareLint(): Promise<string> {
|
||||
const versionConfig = await findLintVersion()
|
||||
return await installLint(versionConfig)
|
||||
const mode = core.getInput("install-mode").toLowerCase()
|
||||
const versionConfig = await findLintVersion(<InstallMode>mode)
|
||||
|
||||
return await installLint(versionConfig, <InstallMode>mode)
|
||||
}
|
||||
|
||||
async function fetchPatch(): Promise<string> {
|
||||
@ -41,7 +44,7 @@ async function fetchPatch(): Promise<string> {
|
||||
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }))
|
||||
let patch: string
|
||||
try {
|
||||
const patchResp = await octokit.pulls.get({
|
||||
const patchResp = await octokit.rest.pulls.get({
|
||||
owner: ctx.repo.owner,
|
||||
repo: ctx.repo.repo,
|
||||
[`pull_number`]: pull.number,
|
||||
@ -66,7 +69,7 @@ async function fetchPatch(): Promise<string> {
|
||||
const tempDir = await createTempDir()
|
||||
const patchPath = path.join(tempDir, "pull.patch")
|
||||
core.info(`Writing patch to ${patchPath}`)
|
||||
await writeFile(patchPath, patch)
|
||||
await writeFile(patchPath, alterDiffPatch(patch))
|
||||
return patchPath
|
||||
} catch (err) {
|
||||
console.warn(`failed to save pull request patch:`, err)
|
||||
@ -83,17 +86,15 @@ async function prepareEnv(): Promise<Env> {
|
||||
const startedAt = Date.now()
|
||||
|
||||
// Prepare cache, lint and go in parallel.
|
||||
const restoreCachePromise = restoreCache()
|
||||
await restoreCache()
|
||||
const prepareLintPromise = prepareLint()
|
||||
const installGoPromise = installGo()
|
||||
const patchPromise = fetchPatch()
|
||||
|
||||
const lintPath = await prepareLintPromise
|
||||
await installGoPromise
|
||||
await restoreCachePromise
|
||||
const patchPath = await patchPromise
|
||||
|
||||
core.info(`Prepared env in ${Date.now() - startedAt}ms`)
|
||||
|
||||
return { lintPath, patchPath }
|
||||
}
|
||||
|
||||
@ -118,21 +119,30 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||
printOutput(res)
|
||||
}
|
||||
|
||||
const userArgs = core.getInput(`args`)
|
||||
let userArgs = core.getInput(`args`)
|
||||
const addedArgs: string[] = []
|
||||
|
||||
const userArgNames = new Set<string>(
|
||||
userArgs
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.map((arg) => arg.split(`=`)[0])
|
||||
.filter((arg) => arg.startsWith(`-`))
|
||||
.map((arg) => arg.replace(/^-+/, ``))
|
||||
)
|
||||
if (userArgNames.has(`out-format`)) {
|
||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
||||
}
|
||||
addedArgs.push(`--out-format=github-actions`)
|
||||
const userArgsList = userArgs
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.filter((arg) => arg.startsWith(`-`))
|
||||
.map((arg) => arg.replace(/^-+/, ``))
|
||||
.map((arg) => arg.split(/=(.*)/, 2))
|
||||
.map<[string, string]>(([key, value]) => [key.toLowerCase(), value ?? ""])
|
||||
|
||||
const userArgsMap = new Map<string, string>(userArgsList)
|
||||
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
|
||||
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",")
|
||||
|
||||
addedArgs.push(`--out-format=${formats}`)
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
||||
|
||||
if (patchPath) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
@ -148,10 +158,6 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
const cmdArgs: ExecOptions = {}
|
||||
if (workingDirectory) {
|
||||
if (patchPath) {
|
||||
// TODO: make them compatible
|
||||
throw new Error(`options working-directory and only-new-issues aren't compatible`)
|
||||
}
|
||||
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||
throw new Error(`working-directory (${workingDirectory}) was not a path`)
|
||||
}
|
||||
@ -161,8 +167,10 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||
cmdArgs.cwd = path.resolve(workingDirectory)
|
||||
}
|
||||
|
||||
const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimRight()
|
||||
const cmd = `${lintPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd()
|
||||
|
||||
core.info(`Running [${cmd}] in [${cmdArgs.cwd || ``}] ...`)
|
||||
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const res = await execShellCommand(cmd, cmdArgs)
|
||||
|
56
src/utils/diffUtils.ts
Normal file
56
src/utils/diffUtils.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import * as core from "@actions/core"
|
||||
import * as path from "path"
|
||||
|
||||
// If needed alter diff file to be compatible with working directory
|
||||
export function alterDiffPatch(patch: string): string {
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
|
||||
if (workingDirectory) {
|
||||
return alterPatchWithWorkingDirectory(patch, workingDirectory)
|
||||
}
|
||||
|
||||
return patch
|
||||
}
|
||||
|
||||
function alterPatchWithWorkingDirectory(patch: string, workingDirectory: string): string {
|
||||
const workspace = process.env["GITHUB_WORKSPACE"] || ""
|
||||
|
||||
const wd = path.relative(workspace, workingDirectory)
|
||||
|
||||
// ignore diff sections not related to the working directory
|
||||
let ignore = false
|
||||
|
||||
const lines = patch.split("\n")
|
||||
const filteredLines = []
|
||||
|
||||
// starts with "--- a/xxx/" or "+++ a/xxx/" or "--- b/xxx/" or "+++ b/xxx/"
|
||||
const cleanDiff = new RegExp(`^((?:\\+{3}|-{3}) [ab]\\/)${escapeRegExp(wd)}\\/(.*)`, "gm")
|
||||
|
||||
// contains " a/xxx/" or " b/xxx/"
|
||||
const firstLine = new RegExp(`( [ab]\\/)${escapeRegExp(wd)}\\/(.*)`, "gm")
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith("diff --git")) {
|
||||
ignore = !line.includes(` a/${wd}/`)
|
||||
if (ignore) {
|
||||
continue
|
||||
}
|
||||
|
||||
filteredLines.push(line.replaceAll(firstLine, "$1$2"))
|
||||
} else {
|
||||
if (ignore) {
|
||||
continue
|
||||
}
|
||||
|
||||
filteredLines.push(line.replaceAll(cleanDiff, "$1$2"))
|
||||
}
|
||||
}
|
||||
|
||||
// Join the modified lines back into a diff string
|
||||
return filteredLines.join("\n")
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
|
||||
function escapeRegExp(exp: string): string {
|
||||
return exp.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") // $& means the whole matched string
|
||||
}
|
@ -3,6 +3,8 @@ import * as httpm from "@actions/http-client"
|
||||
import * as fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
import { InstallMode } from "./install"
|
||||
|
||||
// TODO: make a class
|
||||
export type Version = {
|
||||
major: number
|
||||
@ -17,6 +19,7 @@ const parseVersion = (s: string): Version => {
|
||||
if (s == "latest" || s == "") {
|
||||
return null
|
||||
}
|
||||
|
||||
const match = s.match(versionRe)
|
||||
if (!match) {
|
||||
throw new Error(`invalid version string '${s}', expected format v1.2 or v1.2.3`)
|
||||
@ -61,6 +64,7 @@ const isLessVersion = (a: Version, b: Version): boolean => {
|
||||
const getRequestedLintVersion = (): Version => {
|
||||
let requestedLintVersion = core.getInput(`version`)
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
|
||||
let goMod = "go.mod"
|
||||
if (workingDirectory) {
|
||||
goMod = path.join(workingDirectory, goMod)
|
||||
@ -79,6 +83,7 @@ const getRequestedLintVersion = (): Version => {
|
||||
if (parsedRequestedLintVersion == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (isLessVersion(parsedRequestedLintVersion, minVersion)) {
|
||||
throw new Error(
|
||||
`requested golangci-lint version '${requestedLintVersion}' isn't supported: we support only ${stringifyVersion(
|
||||
@ -86,6 +91,7 @@ const getRequestedLintVersion = (): Version => {
|
||||
)} and later versions`
|
||||
)
|
||||
}
|
||||
|
||||
return parsedRequestedLintVersion
|
||||
}
|
||||
|
||||
@ -120,9 +126,16 @@ const getConfig = async (): Promise<Config> => {
|
||||
}
|
||||
}
|
||||
|
||||
export async function findLintVersion(): Promise<VersionConfig> {
|
||||
export async function findLintVersion(mode: InstallMode): Promise<VersionConfig> {
|
||||
core.info(`Finding needed golangci-lint version...`)
|
||||
|
||||
if (mode == InstallMode.GoInstall) {
|
||||
const v: string = core.getInput(`version`)
|
||||
return { TargetVersion: v ? v : "latest", AssetURL: "github.com/golangci/golangci-lint" }
|
||||
}
|
||||
|
||||
const reqLintVersion = getRequestedLintVersion()
|
||||
|
||||
// if the patched version is passed, just use it
|
||||
if (reqLintVersion?.major !== null && reqLintVersion?.minor != null && reqLintVersion?.patch !== null) {
|
||||
return new Promise((resolve) => {
|
||||
@ -133,6 +146,7 @@ export async function findLintVersion(): Promise<VersionConfig> {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const startedAt = Date.now()
|
||||
|
||||
const config = await getConfig()
|
||||
@ -155,5 +169,6 @@ export async function findLintVersion(): Promise<VersionConfig> {
|
||||
Date.now() - startedAt
|
||||
}ms`
|
||||
)
|
||||
|
||||
return versionConfig
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"target": "ES2021", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
@ -8,7 +8,8 @@
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
"tsBuildInfoFile": ".tsbuildinfo",
|
||||
"incremental": true
|
||||
"incremental": true,
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user