Compare commits
985 Commits
Author | SHA1 | Date | |
---|---|---|---|
4afd733a84 | |||
7774f98a88 | |||
9fae48acfc | |||
16ece5e01d | |||
a3942e2497 | |||
7ecb048b56 | |||
63a0d0e695 | |||
c2427fec79 | |||
642f8ee631 | |||
d84be9250b | |||
9551b25870 | |||
f51fbec16f | |||
a5307c8f68 | |||
2968cc1a32 | |||
1481404843 | |||
dec74fa030 | |||
1f07148fa0 | |||
9938e103f8 | |||
b91d580160 | |||
55c2c1448f | |||
911ec56a22 | |||
eb5c0cc489 | |||
4696ba8bab | |||
2ee514f1f3 | |||
7e7b516e44 | |||
b871b4f9de | |||
08ba820282 | |||
d8648ac2ed | |||
37d62ae433 | |||
7b561e5ab6 | |||
b63dc836c2 | |||
e8b0a12b47 | |||
456fc0f735 | |||
378320cf0d | |||
0bc16cda6e | |||
0f27d1f085 | |||
3b4f037d0e | |||
fe19838e9e | |||
2226d7cb06 | |||
8d744d5b7f | |||
0e58f8e7ab | |||
6a3fb764d5 | |||
696fa5c0e7 | |||
80284ede25 | |||
818ec4d51a | |||
1c50240be2 | |||
0adbc47a59 | |||
f7463c56f6 | |||
32f961426b | |||
e0ebdd245e | |||
ea34ee71d6 | |||
051d919338 | |||
b85ce4ff0a | |||
d9c129682c | |||
db1c463e05 | |||
697ae3d965 | |||
2e788936b0 | |||
aa1e0941ed | |||
3e6beafdff | |||
1cc4e007f0 | |||
bbe109d3f8 | |||
e60da84bfa | |||
1dd93d052e | |||
5421a116d2 | |||
260e8cefdb | |||
9665fb5353 | |||
62530743f6 | |||
f71f362e47 | |||
7ec71f69b1 | |||
60c0fc4730 | |||
a7b658d295 | |||
ec5d18412c | |||
a0297a1378 | |||
58eda26a51 | |||
44c2434506 | |||
2f13b8027d | |||
1ac36865a6 | |||
9937fdf718 | |||
cb60b26e7a | |||
774c35bccc | |||
7ce548721e | |||
0e1fd32b0c | |||
9e66d46e22 | |||
1720a0ed2a | |||
eab1d2f3d7 | |||
160a1d779c | |||
02ee5067dc | |||
311e61576a | |||
363026db34 | |||
ea0c88120e | |||
968ad765a9 | |||
82fb3f49c2 | |||
10480e9d12 | |||
523baec228 | |||
8e06968c92 | |||
79a180da27 | |||
b92645ea9c | |||
3d4174dbf5 | |||
0ddaf3ca3f | |||
971e284b60 | |||
bbe7eb52aa | |||
ebae5cee81 | |||
06c3f3a551 | |||
56689d8f71 | |||
c7bab6f874 | |||
33f56cc1ef | |||
e9542245b2 | |||
68de804037 | |||
22a37566e1 | |||
cb36b7b064 | |||
acfc9fc846 | |||
1b319a7ae6 | |||
0ad4b72404 | |||
de8531069f | |||
2af9b8ff01 | |||
8cae750416 | |||
656a8d69e8 | |||
a3d68bc6f4 | |||
806a9afa81 | |||
e135904846 | |||
931e87202e | |||
aaa42aa062 | |||
9ec89731c3 | |||
58838cffc6 | |||
9f3ba2c3a8 | |||
2bd7a04e91 | |||
db819a10bd | |||
d09fb0808a | |||
605617a3e2 | |||
66f63c74bb | |||
2c01d264ab | |||
d8028e1f20 | |||
a0231c4ff0 | |||
e43020d72a | |||
9e57efc106 | |||
27d925f9c0 | |||
24b3d93762 | |||
26b1e83940 | |||
081b216ccf | |||
0d98fecd83 | |||
031a2fcd4a | |||
96843aea6d | |||
8032b26298 | |||
dfd6a77317 | |||
e1ff6fb1c1 | |||
4145754745 | |||
16507ab8ef | |||
725e01551b | |||
32b7e669bc | |||
e2918bb1f8 | |||
3f51204e49 | |||
b7f3daa60e | |||
952b7b2e57 | |||
7a82e5f967 | |||
4655d13902 | |||
182ce0be58 | |||
bc05d62e37 | |||
8a8f91e859 | |||
34be59169b | |||
abbeba8940 | |||
d7e9c664d4 | |||
42ebe7fde9 | |||
7b547992bc | |||
a4f60bb28d | |||
5815a4b917 | |||
23faadfdeb | |||
b556f25b3c | |||
789f114c52 | |||
d36b91c294 | |||
a9eb115348 | |||
bd4fa7c900 | |||
38e1018663 | |||
21e9e6b47f | |||
dbe4fc23f1 | |||
dbb7ebcd4c | |||
ecb32920c6 | |||
046435d14c | |||
ca8befdfb6 | |||
d9c9b53e53 | |||
aebff4bd9c | |||
2bff406277 | |||
7a6f31107b | |||
57c4c9d189 | |||
3519a25e89 | |||
d073fb8ea7 | |||
9d1e0624a7 | |||
692c9c9dba | |||
ef6d5d0e99 | |||
d149ece3f4 | |||
f89fd48199 | |||
47ef1b2e7f | |||
7c0f80cbb8 | |||
3adb6d0473 | |||
03a8ce6d60 | |||
82d40c283a | |||
c683728f10 | |||
bf6479d5ec | |||
d6238b002a | |||
847b9efe2e | |||
019c5ec617 | |||
3dea681709 | |||
155e5ebdeb | |||
14117827cf | |||
e3c1789d3f | |||
24de455de2 | |||
0068957dcf | |||
8cca243457 | |||
c1ec8d27ed | |||
80ffcf7ac5 | |||
c9cf8614bf | |||
ca92b655d7 | |||
e637d2bbe4 | |||
f7e6ffb14d | |||
04092870fd | |||
15ace4fc54 | |||
66db41e5dd | |||
a54aa6ce0b | |||
0cb4e4ce8a | |||
c2b1114313 | |||
1ef822c9e7 | |||
0cf702c571 | |||
e0e0b2b842 | |||
d7b3f577a7 | |||
a3062e4021 | |||
0cea014686 | |||
c9cca96908 | |||
2e99f461f3 | |||
27463c1456 | |||
47f5f04922 | |||
6d0160cbf8 | |||
52b846a8b5 | |||
3f7fc68782 | |||
1eba11c6d8 | |||
552a57d5dc | |||
a83e3d11f6 | |||
2fc4c770fc | |||
0ea26a0a52 | |||
f1a742892f | |||
2031bb15ab | |||
17bf0db4b7 | |||
de85e3b9b1 | |||
3cfe3a4abb | |||
cbc59cf0d1 | |||
459a04b021 | |||
e2315b67db | |||
d6173a45d0 | |||
0e8f5bf773 | |||
349d20632d | |||
2221aee284 | |||
3b44ae5b24 | |||
323b871bbc | |||
a23373f4c8 | |||
e38f944096 | |||
3c5e1cac39 | |||
0f1139540c | |||
81218f8e0c | |||
cc439c2555 | |||
3efd423e8d | |||
effc519e1b | |||
cfaf0f0750 | |||
86abc3c6d2 | |||
c5ba143a4c | |||
a9d24cbbd7 | |||
2e6adf08a9 | |||
1c2ceb7f27 | |||
5f85afe386 | |||
05d79cc0e4 | |||
edcd1211b8 | |||
eb69bf92e7 | |||
92ed864d2e | |||
3eeea96a33 | |||
c701339303 | |||
e03e943597 | |||
50372b6518 | |||
b6b6b379de | |||
7d8fef21df | |||
0d0b9c12e8 | |||
7989493c23 | |||
f7e7174579 | |||
46a279bd0a | |||
4f796ce6b5 | |||
dd7bdbe4bf | |||
5e13907514 | |||
c0b0a00641 | |||
88688a2400 | |||
a50083874e | |||
8e84a3001a | |||
9a8fa77b90 | |||
677d5e3b79 | |||
abd6e0ea0b | |||
7778b2da3c | |||
bfee5ee11d | |||
608f9e14ec | |||
9381bb2c2c | |||
17e44d79cb | |||
25ef9ca970 | |||
170a3a0cf1 | |||
a76f44e7d8 | |||
8fa7dff7b9 | |||
face0856de | |||
ec66a939a9 | |||
c44dc93f23 | |||
d2a0133e31 | |||
455de4e66d | |||
61c1a4a9f5 | |||
604fe72b13 | |||
3c85045f6e | |||
d9fc28500d | |||
7d357a3513 | |||
b45661bc10 | |||
31c68b6041 | |||
d27d0c27ac | |||
4b1e98b37d | |||
5a72764667 | |||
30416f05a0 | |||
a555e8cdd0 | |||
c8710f274e | |||
40776d7557 | |||
9cb5ef734c | |||
62f96762dd | |||
84072ff78e | |||
a625c15a6b | |||
5545aac6a3 | |||
e09eda33b5 | |||
526ce234e5 | |||
507ec96a74 | |||
252bd8e8ba | |||
07341d3490 | |||
9df6f480ac | |||
6f4d254d44 | |||
a24255b274 | |||
c12092e88f | |||
031ba7f7a9 | |||
c8d4ef2f53 | |||
31c1b1aa98 | |||
31eb4eaded | |||
5f5f252fe2 | |||
c624d54a53 | |||
d735dc073f | |||
846e7ddcd9 | |||
d66278f1e9 | |||
1afd74ce23 | |||
c67416616c | |||
29052a94fb | |||
2d06cf1746 | |||
953db97e74 | |||
f7b4bdd2ad | |||
239c8dab36 | |||
237bd9f909 | |||
fef6a0f2be | |||
2d891f879c | |||
1e9c424622 | |||
cf670955c6 | |||
c49c2afa5d | |||
81871bcfd1 | |||
b2f426ba19 | |||
f8a3dc114e | |||
1330ad3e73 | |||
6efbbade29 | |||
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 | |||
5c56cd6c9d | |||
e3c53feccf | |||
3b9f80ede5 | |||
9845713000 | |||
e789ee158f | |||
f2e9a96352 | |||
818081ab4c | |||
6671836543 | |||
526907ee72 | |||
6b6ba165e0 | |||
9cab4efcbd | |||
0c765721e5 | |||
0dfde21f77 | |||
9dcf389701 | |||
34d3904887 | |||
e30b22f33a | |||
8f30d2584c | |||
0b64a402d8 | |||
973b3a337d | |||
6ea3de1934 | |||
6eec6af39e | |||
d9f0e73c04 | |||
51485a4001 | |||
a12ae43dd8 | |||
f1dee55574 | |||
23487cb16f | |||
84560243ae | |||
3e54e516ae | |||
2f717c44f2 | |||
4a6ab128b0 | |||
f9b6927981 | |||
41858b8c7c | |||
67236c010b | |||
544d2efb30 | |||
0dd30832fc | |||
e1ae6cf354 | |||
0ef0ffc44e | |||
125ac487c1 | |||
e246bba31d | |||
147f37a473 | |||
a19645e82f | |||
286cf073ea | |||
7641a6707d | |||
e4e910b0ce | |||
89d96d6c20 | |||
45f3a377de | |||
943013ec20 | |||
49a9e469b1 | |||
528677aa24 | |||
85798b53e5 | |||
d164f0d6d8 | |||
9cf34bb2b8 | |||
629aad184c | |||
1bac7d9888 | |||
44fae30515 | |||
689e90e8a0 | |||
d73150ab3c | |||
2c3839ff26 | |||
f881d993a0 | |||
d3f3b8adb7 | |||
e3e2a92cbd | |||
e1bd4355fb | |||
345e5340e3 | |||
13e9e901f4 | |||
771153bfbc | |||
e868220d9f | |||
0348c21999 | |||
a1c5369c06 | |||
90fbd40fc4 | |||
3d2a5790a3 | |||
54a84d46fb | |||
ba0e91ca3a | |||
4957db1776 | |||
2ea701ccbd | |||
b6429a6771 | |||
7ba2fe0d4d | |||
b248ff60d3 | |||
0f7d62b0dc | |||
f16cd8cd00 | |||
f745d2bb6b | |||
9bf04a21dc | |||
273fa7ab10 | |||
18087a51d1 | |||
37037d32f2 | |||
9d250b4a7c | |||
e820a262b2 | |||
3b7ba9cb59 | |||
2efd4a3be8 | |||
0098fd17c9 | |||
863caeb194 | |||
1d3f25bff9 | |||
62252c6349 | |||
9535745fa5 | |||
dc87c27dac | |||
87260465c1 | |||
014f5e25d2 | |||
a520c23e6f | |||
6317259e28 | |||
809d3b078b | |||
b026646c83 | |||
c598686db1 | |||
25d72af787 | |||
79f232513c | |||
f7f5eff206 | |||
485c6a047e | |||
e2ff3f296a | |||
294f27a519 | |||
c238b72278 | |||
ba40dc6b1d | |||
65dc624d8b | |||
466abb7dfd | |||
5c7c749f16 | |||
2f458de87f | |||
94d029dd63 | |||
a5502f9224 | |||
fa6ef09daf | |||
2effa0b58a | |||
3b01eb9dce | |||
0d019f3dae | |||
48e7180822 | |||
8577a0ee23 | |||
cf72500b28 | |||
d737e6d962 | |||
8870cfbcd4 | |||
3395f777a4 | |||
04eca20383 | |||
10cbc929b3 | |||
64c208bfbc | |||
20d5541dab | |||
85a3a6abe4 | |||
b66692b61d | |||
348830fe4b | |||
e4cc61e5b1 | |||
27e14e0f3f | |||
6993abb7cd | |||
ca150a071d | |||
1ef31b642a | |||
fc9d1728df | |||
1ad27ad153 | |||
1778ebaefa | |||
1dd9e0522b | |||
66883b5fcf | |||
8ea3043ee4 | |||
95f6eefffa | |||
977a01f96c | |||
13e2c1f984 | |||
afc07fb790 | |||
b7926cae39 | |||
ce34998f1f | |||
1e4a1137a8 | |||
eda878dc56 | |||
f7d08adb03 |
@ -1,7 +1,13 @@
|
||||
{
|
||||
"env": { "node": true, "jest": true },
|
||||
"env": {
|
||||
"node": true,
|
||||
"jest": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": { "ecmaVersion": 2020, "sourceType": "module" },
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
@ -9,15 +15,18 @@
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:import/typescript",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier/@typescript-eslint"
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"simple-import-sort"
|
||||
],
|
||||
"plugins": ["@typescript-eslint", "simple-import-sort"],
|
||||
"rules": {
|
||||
"import/first": "error",
|
||||
"import/newline-after-import": "error",
|
||||
"import/no-duplicates": "error",
|
||||
"simple-import-sort/sort": "error",
|
||||
"simple-import-sort/imports": "error",
|
||||
"simple-import-sort/exports": "error",
|
||||
"sort-imports": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
dist/** linguist-generated=true
|
88
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
88
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
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: workflow-file
|
||||
attributes:
|
||||
label: Workflow file
|
||||
value: |-
|
||||
<details>
|
||||
|
||||
```yml
|
||||
<add your file content here>
|
||||
```
|
||||
|
||||
</details>
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: config
|
||||
attributes:
|
||||
label: Golangci-lint configuration
|
||||
value: |-
|
||||
<details>
|
||||
|
||||
```yml
|
||||
<add your file content 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
|
14
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
14
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 📖 Golangci-lint documentation
|
||||
url: https://golangci-lint.run
|
||||
about: Please take a look to our documentation.
|
||||
- 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: 💬 Chat on Slack
|
||||
url: https://gophers.slack.com/archives/CS0TBRKPC
|
||||
about: Maybe chatting with the community can help
|
||||
- name: 🏡 Golangci-lint main repository
|
||||
url: https://github.com/golangci/golangci-lint
|
||||
about: The main repository of golangci-lint.
|
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
|
15
.github/dependabot.yml
vendored
Normal file
15
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
groups:
|
||||
dev-dependencies:
|
||||
dependency-type: development
|
||||
dependencies:
|
||||
dependency-type: production
|
||||
schedule:
|
||||
interval: weekly
|
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
|
46
.github/workflows/codeql.yaml
vendored
Normal file
46
.github/workflows/codeql.yaml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
name: "Code Scanning - Action"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 17 * * 5'
|
||||
|
||||
jobs:
|
||||
codeQL:
|
||||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
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.
|
||||
# Only include this option if you are running this workflow on pull requests.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
# Only include this step if you are running this workflow on pull requests.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
language: 'javascript'
|
||||
|
||||
- run: |
|
||||
npm install
|
||||
npm run all
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
132
.github/workflows/test.yml
vendored
132
.github/workflows/test.yml
vendored
@ -1,27 +1,127 @@
|
||||
name: "build-test"
|
||||
name: "build-and-test"
|
||||
on: # rebuild any PRs and main branch changes
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 'releases/*'
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build: # make sure build/ci work properly
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- run: |
|
||||
npm install
|
||||
npm run prepare-deps
|
||||
npm run all
|
||||
git diff && git diff --cached
|
||||
- if: ${{ !(github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))) }}
|
||||
uses: actions/checkout@v4
|
||||
- if: github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))
|
||||
uses: actions/checkout@v4
|
||||
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
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build ]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- ubuntu-22.04-arm
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.1"
|
||||
- "v2.1.0"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: ./
|
||||
with:
|
||||
version: v1.26
|
||||
args: --issues-exit-code=0 ./sample/...
|
||||
github-token: ${{ secrets.GOLANGCI_LINT_GITHUB_TOKEN }}
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
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
|
||||
- ubuntu-22.04-arm
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.1.0"
|
||||
- "f6c2e6c999dfae444d1fe7f1b0d49becdae44547"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
||||
only-new-issues: true
|
||||
install-mode: goinstall
|
||||
|
||||
test-go-mod:
|
||||
needs: [ build ]
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- ubuntu-22.04-arm
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
wd:
|
||||
- sample-go-mod
|
||||
- sample-go-tool
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: oldstable
|
||||
- uses: ./
|
||||
with:
|
||||
working-directory: ${{ matrix.wd }}
|
||||
args: --timeout=5m --issues-exit-code=0 ./...
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,7 +6,7 @@ __tests__/runner/*
|
||||
node_modules/
|
||||
lib/
|
||||
|
||||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
# Rest pulled from https://github.com/github/gitignore/blob/HEAD/Node.gitignore
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
@ -97,3 +97,6 @@ typings/
|
||||
|
||||
# Text editor files
|
||||
.vscode/
|
||||
|
||||
# IntelliJ/WebStorm files
|
||||
.idea
|
||||
|
7
.golangci.yml
Normal file
7
.golangci.yml
Normal file
@ -0,0 +1,7 @@
|
||||
version: "2"
|
||||
|
||||
output:
|
||||
show-stats: true
|
||||
sort-order:
|
||||
- file
|
||||
- linter
|
43
CONTRIBUTING.md
Normal file
43
CONTRIBUTING.md
Normal file
@ -0,0 +1,43 @@
|
||||
## How to contribute
|
||||
|
||||
### Did you find a bug?
|
||||
|
||||
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/golangci/golangci-lint-action/issues).
|
||||
|
||||
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/golangci/golangci-lint-action/issues/new).
|
||||
Be sure to include a **title and clear description**, as much relevant information as possible,
|
||||
and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
|
||||
|
||||
* **Do not open up a GitHub issue if the bug is a security vulnerability**,
|
||||
and instead to refer to our [security policy](https://github.com/golangci/golangci-lint-action?tab=security-ov-file).
|
||||
|
||||
### Do you intend to add a new feature or change an existing one?
|
||||
|
||||
* Suggest your change inside an [issue](https://github.com/golangci/golangci-lint-action/issues).
|
||||
|
||||
* Do not open a pull request on GitHub until you have collected positive feedback about the change.
|
||||
|
||||
### Did you write a patch that fixes a bug?
|
||||
|
||||
* Open a new GitHub pull request with the patch.
|
||||
|
||||
* Ensure the PR description clearly describes the problem and solution.
|
||||
Include the relevant issue number if applicable.
|
||||
|
||||
## Development of this action
|
||||
|
||||
1. Install [act](https://github.com/nektos/act#installation)
|
||||
2. Make a symlink for `act` to work properly: `ln -s . golangci-lint-action`
|
||||
3. Install dependencies: `npm install`
|
||||
4. Build: `npm run build`
|
||||
5. Run `npm run local` after any change to test it
|
||||
|
||||
### Releases
|
||||
|
||||
```bash
|
||||
npm version <major | minor | patch> -m "Upgrade to %s"
|
||||
```
|
||||
|
||||
- https://docs.npmjs.com/cli/v11/commands/npm-version
|
||||
|
||||
The "major tag" (ex: `v6`) should be deleted and then recreated manually.
|
@ -1,5 +0,0 @@
|
||||
FROM golangci/golangci-lint:v1.26
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
571
README.md
571
README.md
@ -1,75 +1,572 @@
|
||||
# golangci-lint-action
|
||||
|
||||
[](https://github.com/golangci/golangci-lint-action/actions)
|
||||
[](https://github.com/golangci/golangci-lint-action/actions)
|
||||
|
||||
It's the official GitHub action for [golangci-lint](https://github.com/golangci/golangci-lint) from its 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.
|
||||

|
||||
|
||||
## Supporting Us
|
||||
|
||||
[](https://github.com/sponsors/golangci)
|
||||
[](https://opencollective.com/golangci-lint)
|
||||
[](https://golangci-lint.run/product/thanks/)
|
||||
|
||||
`golangci-lint` is a free and open-source project built by volunteers.
|
||||
|
||||
If you value it, consider supporting us; we appreciate it! :heart:
|
||||
|
||||
## How to use
|
||||
|
||||
1. Create a [GitHub token](https://github.com/settings/tokens/new) with scope `repo.public_repo`.
|
||||
2. Add it to a [repository secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets): repository -> `Settings` -> `Secrets`.
|
||||
3. Add `.github/workflows/golangci-lint.yml` with the following contents:
|
||||
We recommend running this action in a job separate from other jobs (`go test`, etc.)
|
||||
because different jobs [run in parallel](https://help.github.com/en/actions/getting-started-with-github-actions/core-concepts-for-github-actions#job).
|
||||
|
||||
Add `.github/workflows/golangci-lint.yml` with the following contents:
|
||||
|
||||
<details>
|
||||
<summary>Simple Example</summary>
|
||||
|
||||
```yaml
|
||||
name: golangci-lint
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
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@v1
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
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.26
|
||||
|
||||
# Optional: golangci-lint command line arguments.
|
||||
# args: ./the-only-dir-to-analyze/...
|
||||
|
||||
# Required: GitHub token with scope `repo.public_repo`. Used for fetching a list of releases of golangci-lint.
|
||||
github-token: ${{ secrets.GOLANGCI_LINT_GITHUB_TOKEN }}
|
||||
go-version: stable
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.1
|
||||
```
|
||||
|
||||
## Comments and Annotations
|
||||
</details>
|
||||
|
||||
Currently, GitHub parses the action's output and creates [annotations](https://github.community/t5/GitHub-Actions/What-are-annotations/td-p/30770).
|
||||
<details>
|
||||
<summary>Multiple OS Example</summary>
|
||||
|
||||
```yaml
|
||||
name: golangci-lint
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
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: [stable]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
name: lint
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.1
|
||||
```
|
||||
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
|
||||
|
||||
```.gitattributes
|
||||
*.go text eol=lf
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Go Workspace Example</summary>
|
||||
|
||||
```yaml
|
||||
name: golangci-lint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
env:
|
||||
GO_VERSION: stable
|
||||
GOLANGCI_LINT_VERSION: v2.1
|
||||
|
||||
jobs:
|
||||
detect-modules:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
modules: ${{ steps.set-modules.outputs.modules }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- id: set-modules
|
||||
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
|
||||
|
||||
golangci-lint:
|
||||
needs: detect-modules
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: golangci-lint ${{ matrix.modules }}
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||
working-directory: ${{ matrix.modules }}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Go Workspace Example (Multiple OS)</summary>
|
||||
|
||||
```yaml
|
||||
# ./.github/workflows/golangci-lint.yml
|
||||
name: golangci-lint (multi OS)
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
golangci-lint:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ stable, oldstable ]
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
uses: ./.github/workflows/.golangci-lint-reusable.yml
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
go-version: ${{ matrix.go-version }}
|
||||
golangci-lint-version: v2.1
|
||||
```
|
||||
|
||||
```yaml
|
||||
# ./.github/workflows/.golangci-lint-reusable.yml
|
||||
name: golangci-lint-reusable
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
os:
|
||||
description: 'OS'
|
||||
required: true
|
||||
type: string
|
||||
go-version:
|
||||
description: 'Go version'
|
||||
required: true
|
||||
type: string
|
||||
default: stable
|
||||
golangci-lint-version:
|
||||
description: 'Golangci-lint version'
|
||||
type: string
|
||||
default: 'v2.1'
|
||||
|
||||
jobs:
|
||||
detect-modules:
|
||||
runs-on: ${{ inputs.os }}
|
||||
outputs:
|
||||
modules: ${{ steps.set-modules.outputs.modules }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
- id: set-modules
|
||||
shell: bash # require for Windows to be able to use $GITHUB_OUTPUT https://github.com/actions/runner/issues/2224
|
||||
run: echo "modules=$(go list -m -json | jq -s '.' | jq -c '[.[].Dir]')" >> $GITHUB_OUTPUT
|
||||
|
||||
golangci-lint:
|
||||
needs: detect-modules
|
||||
runs-on: ${{ inputs.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
- name: golangci-lint ${{ matrix.modules }}
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: ${{ inputs.golangci-lint-version }}
|
||||
working-directory: ${{ matrix.modules }}
|
||||
```
|
||||
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
|
||||
|
||||
```.gitattributes
|
||||
*.go text eol=lf
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Compatibility
|
||||
|
||||
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
||||
* `v7.0.0` supports golangci-lint v2 only.
|
||||
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
|
||||
* `v5.0.0+` removes `skip-pkg-cache` and `skip-build-cache` because the cache related to Go itself is already handled by `actions/setup-go`.
|
||||
* `v4.0.0+` requires an explicit `actions/setup-go` installation step before using this action: `uses: actions/setup-go@v5`.
|
||||
The `skip-go-installation` option has been removed.
|
||||
* `v2.0.0+` works with `golangci-lint` version >= `v1.28.3`
|
||||
* `v1.2.2` is deprecated because 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))
|
||||
|
||||
## Options
|
||||
|
||||
### `version`
|
||||
|
||||
(optional)
|
||||
|
||||
The version of golangci-lint to use.
|
||||
|
||||
When `install-mode` is:
|
||||
* `binary` (default): the value can be v2.3 or v2.3.4 or `latest` to use the latest version.
|
||||
* `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
|
||||
* `none`: the value is ignored.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.1
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `install-mode`
|
||||
|
||||
(optional)
|
||||
|
||||
The mode to install golangci-lint: it can be `binary`, `goinstall`, or `none`.
|
||||
|
||||
The default value is `binary`.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
install-mode: "goinstall"
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `github-token`
|
||||
|
||||
(optional)
|
||||
|
||||
When using `only-new-issues` option, the GitHub API is used, so a token is required.
|
||||
|
||||
By default, it uses the `github.token` from the action.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
github-token: xxx
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `verify`
|
||||
|
||||
(optional)
|
||||
|
||||
This option is `true` by default.
|
||||
|
||||
If the GitHub Action detects a configuration file, the validation will be performed unless this option is set to `false`.
|
||||
If there is no configuration file, the validation is skipped.
|
||||
|
||||
The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
verify: false
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `only-new-issues`
|
||||
|
||||
(optional)
|
||||
|
||||
Show only new issues.
|
||||
|
||||
The default value is `false`.
|
||||
|
||||
* `pull_request` and `pull_request_target`: the action gets the diff of the PR content from the [GitHub API](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request) and uses it with `--new-from-patch`.
|
||||
* `push`: the action gets the diff of the push content (difference between commits before and after the push) from the [GitHub API](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits) and uses it with `--new-from-patch`.
|
||||
* `merge_group`: the action gets the diff by using `--new-from-rev` option (relies on git).
|
||||
You should add the option `fetch-depth: 0` to `actions/checkout` step.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
only-new-issues: true
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `working-directory`
|
||||
|
||||
(optional)
|
||||
|
||||
Working directory, useful for monorepos.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
working-directory: somedir
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `args`
|
||||
|
||||
(optional)
|
||||
|
||||
golangci-lint command line arguments.
|
||||
|
||||
> [!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=`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Adding a `=` between the flag name and its value is important because the action parses the arguments on spaces.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
# In some rare cases,
|
||||
# you could have to use `${{ github.workspace }}` as base directory to reference your configuration file.
|
||||
args: --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `problem-matchers`
|
||||
|
||||
(optional)
|
||||
|
||||
Force the usage of the embedded problem matchers.
|
||||
|
||||
By default, the [problem matcher of Go (`actions/setup-go`)](https://github.com/actions/setup-go/blob/main/matchers.json) already handles the default golangci-lint output (`text`).
|
||||
|
||||
Works only with `text` format (the golangci-lint default).
|
||||
|
||||
https://golangci-lint.run/usage/configuration/#output-configuration
|
||||
|
||||
The default value is `false`.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
problem-matchers: true
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `skip-cache`
|
||||
|
||||
(optional)
|
||||
|
||||
If set to `true`, then all caching functionality will be completely disabled,
|
||||
takes precedence over all other caching options.
|
||||
|
||||
The default value is `false`.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
skip-cache: true
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `skip-save-cache`
|
||||
|
||||
(optional)
|
||||
|
||||
If set to `true`, caches will not be saved, but they may still be restored, requiring `skip-cache: false`.
|
||||
|
||||
The default value is `false`.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
skip-save-cache: true
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### `cache-invalidation-interval`
|
||||
|
||||
(optional)
|
||||
|
||||
Periodically invalidate the cache every `cache-invalidation-interval` days to ensure that outdated data is removed and fresh data is loaded.
|
||||
|
||||
The default value is `7`.
|
||||
|
||||
If the number is `<= 0`, the cache will always be invalidated (Not recommended).
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
cache-invalidation-interval: 15
|
||||
# ...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Annotations
|
||||
|
||||
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
||||
|
||||
The restrictions of annotations are the following:
|
||||
|
||||
1. Currently, they don't support markdown formatting (see the [feature request](https://github.community/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704))
|
||||
2. They aren't shown in 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).
|
||||
1. Currently, they don't support Markdown formatting (see the [feature request](https://github.community/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704))
|
||||
2. They aren't shown in the list of comments.
|
||||
If you would like to have comments - please, up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
|
||||
3. The number of annotations is [limited](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md#limitations).
|
||||
|
||||
Permissions required:
|
||||
|
||||
```yaml annotate
|
||||
permissions:
|
||||
# Required: allow read access to the content for analysis.
|
||||
contents: read
|
||||
# Optional: allow read access to pull request. Use with `only-new-issues` option.
|
||||
pull-requests: read
|
||||
```
|
||||
|
||||
For annotations to work, use the default format output (`text`) and either use `actions/setup-go` in the job or enable the internal [problem matchers](#problem-matchers).
|
||||
|
||||
## Performance
|
||||
|
||||
The action was implemented with performance in mind:
|
||||
|
||||
1. We cache data from golangci-lint analysis between builds by using [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache).
|
||||
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, 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:
|
||||
* 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:
|
||||
We use JavaScript-based action.
|
||||
We don't use Docker-based action because:
|
||||
|
||||
1. docker pulling is slow currently
|
||||
2. it's easier to use caching from [@actions/cache](https://github.com/actions/cache) until GitHub team hasn't supported reusing actions from actions
|
||||
1. Docker pulling is slow currently
|
||||
2. it's easier to use caching from [@actions/cache](https://github.com/actions/toolkit/tree/HEAD/packages/cache)
|
||||
|
||||
Inside our action we perform 3 steps:
|
||||
We support different platforms, such as `ubuntu`, `macos`, and `windows` with `x32` and `x64` archs.
|
||||
|
||||
Inside our action, we perform 3 steps:
|
||||
|
||||
1. Setup environment running in parallel:
|
||||
* restore [cache](https://github.com/actions/cache) of previous analyzes into `$HOME/.cache/golangci-lint`
|
||||
* list [releases of golangci-lint](https://github.com/golangci/golangci-lint/releases) and find the latest patch version
|
||||
for needed version (users of this action can specify only minor version). 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)
|
||||
* restore [cache](https://github.com/actions/cache) of previous analyses
|
||||
* fetch [action config](https://github.com/golangci/golangci-lint/blob/HEAD/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/HEAD/packages/tool-cache)
|
||||
2. Run `golangci-lint` with specified by user `args`
|
||||
3. Save cache from `$HOME/.cache/golangci-lint` for later builds
|
||||
3. Save cache for later builds
|
||||
|
||||
## Development of this action
|
||||
### Caching internals
|
||||
|
||||
1. Install [act](https://github.com/nektos/act#installation)
|
||||
2. Make a symlink for `act` to work properly: `ln -s . golangci-lint-action`
|
||||
3. Get a [GitHub token](https://github.com/settings/tokens/new) with the scope `repo.public_repo`. Export it by `export GITHUB_TOKEN=YOUR_TOKEN`.
|
||||
4. Prepare deps once: `npm run prepare-deps`
|
||||
5. Run `npm run local` after any change to test it
|
||||
1. We save and restore the following directory: `~/.cache/golangci-lint`.
|
||||
2. The primary caching key looks like `golangci-lint.cache-{runner_os}-{working_directory}-{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-{runner_os}-{working_directory}-{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.
|
||||
|
74
action.yml
74
action.yml
@ -1,23 +1,63 @@
|
||||
---
|
||||
name: 'Run golangci-lint'
|
||||
description: 'Run golangci-lint (WIP)'
|
||||
author: 'golangci'
|
||||
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
|
||||
name: "Golangci-lint"
|
||||
description: "Official golangci-lint action with line-attached annotations for found issues, caching and parallel execution."
|
||||
author: "golangci"
|
||||
inputs:
|
||||
version:
|
||||
description: 'version of golangci-lint to use in form of v1.2.3'
|
||||
required: true
|
||||
args:
|
||||
description: 'golangci-lint command line arguments'
|
||||
default: ''
|
||||
description: |
|
||||
The version of golangci-lint to use.
|
||||
When `install-mode` is:
|
||||
- `binary` (default): the value can be v2.3 or v2.3.4 or `latest` to use the latest version.
|
||||
- `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
|
||||
- `none`: the value is ignored.
|
||||
required: false
|
||||
install-mode:
|
||||
description: "The mode to install golangci-lint. It can be 'binary', 'goinstall', or 'none'."
|
||||
default: "binary"
|
||||
required: false
|
||||
working-directory:
|
||||
description: "golangci-lint working directory, default is project root"
|
||||
required: false
|
||||
github-token:
|
||||
description: 'GitHub token with scope `repo.public_repo`. Used for fetching a list of releases of golangci-lint.'
|
||||
required: true
|
||||
|
||||
description: "the token is used for fetching patch of a pull request to show only new issues"
|
||||
default: ${{ github.token }}
|
||||
required: false
|
||||
verify:
|
||||
description: "if set to true and the action verify the configuration file against the JSONSchema"
|
||||
default: '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: 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-save-cache:
|
||||
description: |
|
||||
if set to true then the action will not save any caches, but it may still
|
||||
restore existing caches, subject to other options.
|
||||
default: 'false'
|
||||
required: false
|
||||
problem-matchers:
|
||||
description: "Force the usage of the embedded problem matchers"
|
||||
default: 'false'
|
||||
required: false
|
||||
args:
|
||||
description: "golangci-lint command line arguments"
|
||||
default: ""
|
||||
required: false
|
||||
cache-invalidation-interval:
|
||||
description: "Periodically invalidate a cache because a new code being added. (number of days)"
|
||||
default: '7'
|
||||
required: false
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'dist/run/index.js'
|
||||
post: 'dist/post_run/index.js'
|
||||
using: "node20"
|
||||
main: "dist/run/index.js"
|
||||
post: "dist/post_run/index.js"
|
||||
branding:
|
||||
icon: 'check-circle'
|
||||
color: 'blue'
|
||||
icon: "shield"
|
||||
color: "white"
|
||||
|
2
dist/matchers.json
generated
vendored
2
dist/matchers.json
generated
vendored
@ -1,7 +1,7 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "golangci-lint-action",
|
||||
"owner": "go",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^\\s*(\\.{0,2}[\\/\\\\].+\\.go):(?:(\\d+):(\\d+):)? (.*)",
|
||||
|
124861
dist/post_run/index.js
generated
vendored
124861
dist/post_run/index.js
generated
vendored
File diff suppressed because one or more lines are too long
124861
dist/run/index.js
generated
vendored
124861
dist/run/index.js
generated
vendored
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo 'golangci-lint-action: start'
|
||||
echo " flags: ${INPUT_FLAGS}"
|
||||
echo " format: ${INPUT_FORMAT}"
|
||||
|
||||
cd "${GITHUB_WORKSPACE}/${INPUT_DIRECTORY}" || exit 1
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
golangci-lint run --out-format ${INPUT_FORMAT} ${INPUT_FLAGS}
|
3
go.mod
Normal file
3
go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module github.com/golangci/golangci-lint-action
|
||||
|
||||
go 1.23
|
5087
package-lock.json
generated
5087
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
56
package.json
56
package.json
@ -1,49 +1,53 @@
|
||||
{
|
||||
"name": "golanci-lint-action",
|
||||
"version": "1.1.2",
|
||||
"version": "8.0.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-cache": "cd node_modules/cache && npm run build",
|
||||
"prepare-deps": "npm run prepare-setup-go && npm run prepare-cache",
|
||||
"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",
|
||||
"type-check": "tsc",
|
||||
"lint": "eslint **/*.ts --cache",
|
||||
"lint": "eslint --max-warnings 1 **/*.ts --cache",
|
||||
"lint-fix": "eslint **/*.ts --cache --fix",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"all": "npm run build && npm run format-check && npm run lint",
|
||||
"local": "npm run build && act -j test -s GOLANGCI_LINT_GITHUB_TOKEN=$GITHUB_TOKEN"
|
||||
"local": "npm run build && act -j test -b",
|
||||
"local-full-version": "npm run build && act -j test-full-version -b"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/golangci/golangci-lint-action.git"
|
||||
},
|
||||
"author": "GitHub",
|
||||
"author": "golangci",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/github": "^2.1.1",
|
||||
"@actions/tool-cache": "^1.3.4",
|
||||
"@types/semver": "^7.1.0",
|
||||
"cache": "git+https://github.com/golangci/cache.git",
|
||||
"setup-go": "git+https://github.com/actions/setup-go.git"
|
||||
"@actions/cache": "^4.0.3",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/http-client": "^2.2.3",
|
||||
"@octokit/plugin-retry": "^6.1.0",
|
||||
"@actions/tool-cache": "^2.0.2",
|
||||
"@types/node": "^22.14.1",
|
||||
"@types/semver": "^7.7.0",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"@types/which": "^3.0.4",
|
||||
"tmp": "^0.2.3",
|
||||
"which": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.4",
|
||||
"@types/uuid": "^3.4.5",
|
||||
"@typescript-eslint/eslint-plugin": "^2.7.0",
|
||||
"@typescript-eslint/parser": "^2.7.0",
|
||||
"@zeit/ncc": "^0.20.5",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-prettier": "^6.5.0",
|
||||
"eslint-plugin-import": "^2.18.2",
|
||||
"eslint-plugin-prettier": "^3.1.1",
|
||||
"eslint-plugin-simple-import-sort": "^5.0.2",
|
||||
"prettier": "^1.19.1",
|
||||
"typescript": "^3.8.3"
|
||||
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
||||
"@typescript-eslint/parser": "^8.30.1",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^10.1.2",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-prettier": "^5.2.6",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"prettier": "^3.5.3",
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
}
|
||||
|
17
problem-matchers.json
Normal file
17
problem-matchers.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "golangci-lint-colored-line-number",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^([^:]+):(\\d+):(?:(\\d+):)?\\s+(.+ \\(.+\\))$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
7
sample-go-mod/.golangci.yml
Normal file
7
sample-go-mod/.golangci.yml
Normal file
@ -0,0 +1,7 @@
|
||||
version: "2"
|
||||
|
||||
output:
|
||||
show-stats: true
|
||||
sort-order:
|
||||
- file
|
||||
- linter
|
205
sample-go-mod/go.mod
Normal file
205
sample-go-mod/go.mod
Normal file
@ -0,0 +1,205 @@
|
||||
module sample
|
||||
|
||||
go 1.23.0
|
||||
|
||||
require github.com/golangci/golangci-lint/v2 v2.1.5
|
||||
|
||||
require (
|
||||
4d63.com/gocheckcompilerdirectives v1.3.0 // indirect
|
||||
4d63.com/gochecknoglobals v0.2.2 // indirect
|
||||
github.com/4meepo/tagalign v1.4.2 // indirect
|
||||
github.com/Abirdcfly/dupword v0.1.3 // indirect
|
||||
github.com/Antonboom/errname v1.1.0 // indirect
|
||||
github.com/Antonboom/nilnil v1.1.0 // indirect
|
||||
github.com/Antonboom/testifylint v1.6.1 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.1 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.3.1 // indirect
|
||||
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect
|
||||
github.com/alecthomas/chroma/v2 v2.16.0 // indirect
|
||||
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
|
||||
github.com/alexkohler/nakedret/v2 v2.0.6 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/alingse/asasalint v0.0.11 // indirect
|
||||
github.com/alingse/nilnesserr v0.2.0 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.6.0 // indirect
|
||||
github.com/ashanbrown/makezero v1.2.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.3 // indirect
|
||||
github.com/blizzy78/varnamelen v0.8.0 // indirect
|
||||
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
|
||||
github.com/breml/bidichk v0.3.3 // indirect
|
||||
github.com/breml/errchkjson v0.4.1 // indirect
|
||||
github.com/butuzov/ireturn v0.4.0 // indirect
|
||||
github.com/butuzov/mirror v1.3.0 // indirect
|
||||
github.com/catenacyber/perfsprint v0.9.1 // indirect
|
||||
github.com/ccojocar/zxcvbn-go v1.0.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/charithe/durationcheck v0.0.10 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
|
||||
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.8.0 // indirect
|
||||
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
|
||||
github.com/charmbracelet/x/term v0.2.1 // indirect
|
||||
github.com/chavacava/garif v0.1.0 // indirect
|
||||
github.com/ckaznocha/intrange v0.3.1 // indirect
|
||||
github.com/curioswitch/go-reassign v0.3.0 // indirect
|
||||
github.com/daixiang0/gci v0.13.6 // indirect
|
||||
github.com/dave/dst v0.27.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.5.0 // indirect
|
||||
github.com/dlclark/regexp2 v1.11.5 // indirect
|
||||
github.com/ettle/strcase v0.2.0 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.6 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
github.com/ghostiam/protogetter v0.3.15 // indirect
|
||||
github.com/go-critic/go-critic v0.13.0 // indirect
|
||||
github.com/go-toolsmith/astcast v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astequal v1.2.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-viper/mapstructure/v2 v2.2.1 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.12.1 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect
|
||||
github.com/golangci/go-printf-func-name v0.1.0 // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
|
||||
github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 // indirect
|
||||
github.com/golangci/misspell v0.6.0 // indirect
|
||||
github.com/golangci/plugin-module-register v0.1.1 // indirect
|
||||
github.com/golangci/revgrep v0.8.0 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.1.0 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.5.0 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
|
||||
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hexops/gotextdiff v1.0.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jgautheron/goconst v1.8.1 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jjti/go-spancheck v0.6.4 // indirect
|
||||
github.com/julz/importas v0.2.0 // indirect
|
||||
github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect
|
||||
github.com/kisielk/errcheck v1.9.0 // indirect
|
||||
github.com/kkHAIKE/contextcheck v1.1.6 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.14 // indirect
|
||||
github.com/lasiar/canonicalheader v1.1.2 // indirect
|
||||
github.com/ldez/exptostd v0.4.3 // indirect
|
||||
github.com/ldez/gomoddirectives v0.6.1 // indirect
|
||||
github.com/ldez/grignotin v0.9.0 // indirect
|
||||
github.com/ldez/tagliatelle v0.7.1 // indirect
|
||||
github.com/ldez/usetesting v0.4.3 // indirect
|
||||
github.com/leonklingele/grouper v1.1.2 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/macabu/inamedparam v0.2.0 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/manuelarte/funcorder v0.2.1 // indirect
|
||||
github.com/maratori/testableexamples v1.0.0 // indirect
|
||||
github.com/maratori/testpackage v1.1.1 // indirect
|
||||
github.com/matoous/godox v1.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mgechev/revive v1.9.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/moricho/tparallel v0.3.2 // indirect
|
||||
github.com/muesli/termenv v0.16.0 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nishanths/exhaustive v0.12.0 // indirect
|
||||
github.com/nishanths/predeclared v0.2.2 // indirect
|
||||
github.com/nunnatsa/ginkgolinter v0.19.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.2.4 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/polyfloyd/go-errorlint v1.8.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.4.4 // indirect
|
||||
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
|
||||
github.com/quasilyte/gogrep v0.5.0 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/raeperd/recvcheck v0.2.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.4.1 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.22.3 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/sivchari/containedctx v1.0.3 // indirect
|
||||
github.com/sonatard/noctx v0.1.0 // indirect
|
||||
github.com/sourcegraph/go-diff v0.7.0 // indirect
|
||||
github.com/spf13/afero v1.14.0 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/cobra v1.9.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.6 // 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.2.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/stretchr/testify v1.10.0 // indirect
|
||||
github.com/subosito/gotenv v1.4.1 // indirect
|
||||
github.com/tdakkota/asciicheck v0.4.1 // indirect
|
||||
github.com/tetafro/godot v1.5.0 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect
|
||||
github.com/timonwong/loggercheck v0.11.0 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.11.0 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
|
||||
github.com/ultraware/funlen v0.2.0 // indirect
|
||||
github.com/ultraware/whitespace v0.2.0 // indirect
|
||||
github.com/uudashr/gocognit v1.2.0 // indirect
|
||||
github.com/uudashr/iface v1.3.1 // indirect
|
||||
github.com/xen0n/gosmopolitan v1.3.0 // indirect
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||
github.com/yagipy/maintidx v1.0.0 // indirect
|
||||
github.com/yeya24/promlinter v0.3.0 // indirect
|
||||
github.com/ykadowak/zerologlint v0.1.5 // indirect
|
||||
gitlab.com/bosi/decorder v0.4.2 // indirect
|
||||
go-simpler.org/musttag v0.13.0 // indirect
|
||||
go-simpler.org/sloglint v0.11.0 // indirect
|
||||
go.augendre.info/fatcontext v0.8.0 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/automaxprocs v1.6.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.24.0 // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
|
||||
golang.org/x/mod v0.24.0 // indirect
|
||||
golang.org/x/sync v0.13.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/text v0.24.0 // indirect
|
||||
golang.org/x/tools v0.32.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // 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.6.1 // indirect
|
||||
mvdan.cc/gofumpt v0.8.0 // indirect
|
||||
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect
|
||||
)
|
1003
sample-go-mod/go.sum
Normal file
1003
sample-go-mod/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
26
sample-go-mod/sample.go
Normal file
26
sample-go-mod/sample.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Package main is used as test input for golangci action.
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Hash~
|
||||
func Hash(data string) string {
|
||||
retError()
|
||||
retError2()
|
||||
|
||||
h := md5.New()
|
||||
h.Write([]byte(data))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
func retError() error {
|
||||
return errors.New("err")
|
||||
}
|
||||
|
||||
func retError2() error {
|
||||
return errors.New("err2")
|
||||
}
|
7
sample-go-mod/tools.go
Normal file
7
sample-go-mod/tools.go
Normal file
@ -0,0 +1,7 @@
|
||||
//go:build tools
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint"
|
||||
)
|
7
sample-go-tool/.golangci.yml
Normal file
7
sample-go-tool/.golangci.yml
Normal file
@ -0,0 +1,7 @@
|
||||
version: "2"
|
||||
|
||||
output:
|
||||
show-stats: true
|
||||
sort-order:
|
||||
- file
|
||||
- linter
|
210
sample-go-tool/go.mod
Normal file
210
sample-go-tool/go.mod
Normal file
@ -0,0 +1,210 @@
|
||||
module sample
|
||||
|
||||
go 1.24
|
||||
|
||||
toolchain go1.24.0
|
||||
|
||||
tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint
|
||||
|
||||
require (
|
||||
4d63.com/gocheckcompilerdirectives v1.3.0 // indirect
|
||||
4d63.com/gochecknoglobals v0.2.2 // indirect
|
||||
github.com/4meepo/tagalign v1.4.2 // indirect
|
||||
github.com/Abirdcfly/dupword v0.1.3 // indirect
|
||||
github.com/Antonboom/errname v1.1.0 // indirect
|
||||
github.com/Antonboom/nilnil v1.1.0 // indirect
|
||||
github.com/Antonboom/testifylint v1.6.1 // indirect
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/Crocmagnon/fatcontext v0.7.1 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.1 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.3.1 // indirect
|
||||
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 // indirect
|
||||
github.com/alecthomas/chroma/v2 v2.17.2 // indirect
|
||||
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
|
||||
github.com/alexkohler/nakedret/v2 v2.0.6 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/alingse/asasalint v0.0.11 // indirect
|
||||
github.com/alingse/nilnesserr v0.2.0 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.6.0 // indirect
|
||||
github.com/ashanbrown/makezero v1.2.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.3 // indirect
|
||||
github.com/blizzy78/varnamelen v0.8.0 // indirect
|
||||
github.com/bombsimon/wsl/v4 v4.7.0 // indirect
|
||||
github.com/breml/bidichk v0.3.3 // indirect
|
||||
github.com/breml/errchkjson v0.4.1 // indirect
|
||||
github.com/butuzov/ireturn v0.4.0 // indirect
|
||||
github.com/butuzov/mirror v1.3.0 // indirect
|
||||
github.com/catenacyber/perfsprint v0.9.1 // indirect
|
||||
github.com/ccojocar/zxcvbn-go v1.0.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/charithe/durationcheck v0.0.10 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
|
||||
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
||||
github.com/charmbracelet/x/ansi v0.8.0 // indirect
|
||||
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
|
||||
github.com/charmbracelet/x/term v0.2.1 // indirect
|
||||
github.com/chavacava/garif v0.1.0 // indirect
|
||||
github.com/ckaznocha/intrange v0.3.1 // indirect
|
||||
github.com/curioswitch/go-reassign v0.3.0 // indirect
|
||||
github.com/daixiang0/gci v0.13.6 // indirect
|
||||
github.com/dave/dst v0.27.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.5.0 // indirect
|
||||
github.com/dlclark/regexp2 v1.11.5 // indirect
|
||||
github.com/ettle/strcase v0.2.0 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.6 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
github.com/ghostiam/protogetter v0.3.15 // indirect
|
||||
github.com/go-critic/go-critic v0.13.0 // indirect
|
||||
github.com/go-toolsmith/astcast v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astequal v1.2.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-viper/mapstructure/v2 v2.2.1 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.12.1 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32 // indirect
|
||||
github.com/golangci/go-printf-func-name v0.1.0 // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect
|
||||
github.com/golangci/golangci-lint/v2 v2.1.6 // indirect
|
||||
github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95 // indirect
|
||||
github.com/golangci/misspell v0.6.0 // indirect
|
||||
github.com/golangci/plugin-module-register v0.1.1 // indirect
|
||||
github.com/golangci/revgrep v0.8.0 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20250410112200-a129a6e6413e // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.1.0 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.5.0 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
|
||||
github.com/hashicorp/go-version v1.7.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hexops/gotextdiff v1.0.3 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jgautheron/goconst v1.8.1 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jjti/go-spancheck v0.6.4 // indirect
|
||||
github.com/julz/importas v0.2.0 // indirect
|
||||
github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect
|
||||
github.com/kisielk/errcheck v1.9.0 // indirect
|
||||
github.com/kkHAIKE/contextcheck v1.1.6 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.14 // indirect
|
||||
github.com/lasiar/canonicalheader v1.1.2 // indirect
|
||||
github.com/ldez/exptostd v0.4.3 // indirect
|
||||
github.com/ldez/gomoddirectives v0.6.1 // indirect
|
||||
github.com/ldez/grignotin v0.9.0 // indirect
|
||||
github.com/ldez/tagliatelle v0.7.1 // indirect
|
||||
github.com/ldez/usetesting v0.4.3 // indirect
|
||||
github.com/leonklingele/grouper v1.1.2 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/macabu/inamedparam v0.2.0 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/manuelarte/funcorder v0.2.1 // indirect
|
||||
github.com/maratori/testableexamples v1.0.0 // indirect
|
||||
github.com/maratori/testpackage v1.1.1 // indirect
|
||||
github.com/matoous/godox v1.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mgechev/revive v1.9.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/moricho/tparallel v0.3.2 // indirect
|
||||
github.com/muesli/termenv v0.16.0 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nishanths/exhaustive v0.12.0 // indirect
|
||||
github.com/nishanths/predeclared v0.2.2 // indirect
|
||||
github.com/nunnatsa/ginkgolinter v0.19.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.2.4 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/polyfloyd/go-errorlint v1.8.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.4.4 // indirect
|
||||
github.com/quasilyte/go-ruleguard/dsl v0.3.22 // indirect
|
||||
github.com/quasilyte/gogrep v0.5.0 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/raeperd/recvcheck v0.2.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.4.1 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.22.3 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/sivchari/containedctx v1.0.3 // indirect
|
||||
github.com/sivchari/tenv v1.12.1 // indirect
|
||||
github.com/sonatard/noctx v0.1.0 // indirect
|
||||
github.com/sourcegraph/go-diff v0.7.0 // indirect
|
||||
github.com/spf13/afero v1.14.0 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/cobra v1.9.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.6 // 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.2.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/stretchr/testify v1.10.0 // indirect
|
||||
github.com/subosito/gotenv v1.4.1 // indirect
|
||||
github.com/tdakkota/asciicheck v0.4.1 // indirect
|
||||
github.com/tetafro/godot v1.5.1 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 // indirect
|
||||
github.com/timonwong/loggercheck v0.11.0 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.11.0 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
|
||||
github.com/ultraware/funlen v0.2.0 // indirect
|
||||
github.com/ultraware/whitespace v0.2.0 // indirect
|
||||
github.com/uudashr/gocognit v1.2.0 // indirect
|
||||
github.com/uudashr/iface v1.3.1 // indirect
|
||||
github.com/xen0n/gosmopolitan v1.3.0 // indirect
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||
github.com/yagipy/maintidx v1.0.0 // indirect
|
||||
github.com/yeya24/promlinter v0.3.0 // indirect
|
||||
github.com/ykadowak/zerologlint v0.1.5 // indirect
|
||||
gitlab.com/bosi/decorder v0.4.2 // indirect
|
||||
go-simpler.org/musttag v0.13.1 // indirect
|
||||
go-simpler.org/sloglint v0.11.0 // indirect
|
||||
go.augendre.info/fatcontext v0.8.0 // indirect
|
||||
go.uber.org/atomic v1.7.0 // indirect
|
||||
go.uber.org/automaxprocs v1.6.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.24.0 // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect
|
||||
golang.org/x/mod v0.24.0 // indirect
|
||||
golang.org/x/sync v0.13.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/text v0.24.0 // indirect
|
||||
golang.org/x/tools v0.32.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // 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.6.1 // indirect
|
||||
mvdan.cc/gofumpt v0.8.0 // indirect
|
||||
mvdan.cc/unparam v0.0.0-20250301125049-0df0534333a4 // indirect
|
||||
)
|
1079
sample-go-tool/go.sum
Normal file
1079
sample-go-tool/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
26
sample-go-tool/sample.go
Normal file
26
sample-go-tool/sample.go
Normal file
@ -0,0 +1,26 @@
|
||||
// Package main is used as test input for golangci action.
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Hash~
|
||||
func Hash(data string) string {
|
||||
retError()
|
||||
retError2()
|
||||
|
||||
h := md5.New()
|
||||
h.Write([]byte(data))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
func retError() error {
|
||||
return errors.New("err")
|
||||
}
|
||||
|
||||
func retError2() error {
|
||||
return errors.New("err2")
|
||||
}
|
@ -4,11 +4,23 @@ package sample
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Hash~
|
||||
func Hash(data string) string {
|
||||
retError()
|
||||
retError2()
|
||||
|
||||
h := md5.New()
|
||||
h.Write([]byte(data))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
func retError() error {
|
||||
return errors.New("err")
|
||||
}
|
||||
|
||||
func retError2() error {
|
||||
return errors.New("err2")
|
||||
}
|
||||
|
157
src/cache.ts
157
src/cache.ts
@ -1,29 +1,158 @@
|
||||
import * as cache from "@actions/cache"
|
||||
import * as core from "@actions/core"
|
||||
import restore from "cache/lib/restore"
|
||||
import save from "cache/lib/save"
|
||||
import * as crypto from "crypto"
|
||||
import * as fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
// TODO: ensure dir exists, have access, etc
|
||||
const getCacheDir = (): string => `${process.env.HOME}/.cache/golangci-lint`
|
||||
import { Events, State } from "./constants"
|
||||
import * as utils from "./utils/actionUtils"
|
||||
|
||||
const setCacheInputs = (): void => {
|
||||
process.env.INPUT_KEY = `golangci-lint.analysis-cache`
|
||||
process.env.INPUT_PATH = getCacheDir()
|
||||
function checksumFile(hashName: string, path: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const hash = crypto.createHash(hashName)
|
||||
const stream = fs.createReadStream(path)
|
||||
stream.on("error", (err) => reject(err))
|
||||
stream.on("data", (chunk) => hash.update(chunk))
|
||||
stream.on("end", () => resolve(hash.digest("hex")))
|
||||
})
|
||||
}
|
||||
|
||||
const pathExists = async (path: string): Promise<boolean> => !!(await fs.promises.stat(path).catch(() => false))
|
||||
|
||||
const getLintCacheDir = (): string => {
|
||||
const home = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME
|
||||
|
||||
return path.resolve(`${home}`, `.cache`, `golangci-lint`)
|
||||
}
|
||||
|
||||
const getIntervalKey = (invalidationIntervalDays: number): string => {
|
||||
const now = new Date()
|
||||
|
||||
if (invalidationIntervalDays <= 0) {
|
||||
return `${now.getTime()}`
|
||||
}
|
||||
|
||||
const secondsSinceEpoch = now.getTime() / 1000
|
||||
const intervalNumber = Math.floor(secondsSinceEpoch / (invalidationIntervalDays * 86400))
|
||||
return intervalNumber.toString()
|
||||
}
|
||||
|
||||
async function buildCacheKeys(): Promise<string[]> {
|
||||
const keys = []
|
||||
|
||||
// Cache by OS.
|
||||
let cacheKey = `golangci-lint.cache-${process.env?.RUNNER_OS}-`
|
||||
|
||||
// Get working directory from input
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
|
||||
if (workingDirectory) {
|
||||
cacheKey += `${workingDirectory}-`
|
||||
}
|
||||
|
||||
// Periodically invalidate a cache because a new code being added.
|
||||
const invalidationIntervalDays = parseInt(core.getInput(`cache-invalidation-interval`, { required: true }).trim())
|
||||
cacheKey += `${getIntervalKey(invalidationIntervalDays)}-`
|
||||
|
||||
keys.push(cacheKey)
|
||||
|
||||
// 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`, goModPath)
|
||||
} else {
|
||||
cacheKey += `nogomod`
|
||||
}
|
||||
|
||||
keys.push(cacheKey)
|
||||
|
||||
return keys
|
||||
}
|
||||
|
||||
export async function restoreCache(): Promise<void> {
|
||||
if (core.getBooleanInput(`skip-cache`, { required: 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.`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const startedAt = Date.now()
|
||||
setCacheInputs()
|
||||
|
||||
const keys = await buildCacheKeys()
|
||||
const primaryKey = keys.pop()
|
||||
const restoreKeys = keys.reverse()
|
||||
|
||||
// Tell golangci-lint to use our cache directory.
|
||||
process.env.GOLANGCI_LINT_CACHE = getCacheDir()
|
||||
process.env.GOLANGCI_LINT_CACHE = getLintCacheDir()
|
||||
|
||||
await restore()
|
||||
core.info(`Restored golangci-lint analysis cache in ${Date.now() - startedAt}ms`)
|
||||
if (!primaryKey) {
|
||||
utils.logWarning(`Invalid primary key`)
|
||||
return
|
||||
}
|
||||
core.saveState(State.CachePrimaryKey, primaryKey)
|
||||
try {
|
||||
const cacheKey = await cache.restoreCache([getLintCacheDir()], primaryKey, restoreKeys)
|
||||
if (!cacheKey) {
|
||||
core.info(`Cache not found for input keys: ${[primaryKey, ...restoreKeys].join(", ")}`)
|
||||
return
|
||||
}
|
||||
// Store the matched cache key
|
||||
utils.setCacheState(cacheKey)
|
||||
core.info(`Restored cache for golangci-lint from key '${primaryKey}' in ${Date.now() - startedAt}ms`)
|
||||
} catch (error) {
|
||||
if (error.name === cache.ValidationError.name) {
|
||||
throw error
|
||||
} else {
|
||||
core.warning(error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveCache(): Promise<void> {
|
||||
if (core.getBooleanInput(`skip-cache`, { required: true })) return
|
||||
if (core.getBooleanInput(`skip-save-cache`, { required: true })) return
|
||||
|
||||
// Validate inputs, this can cause task failure
|
||||
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.`
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const startedAt = Date.now()
|
||||
setCacheInputs()
|
||||
await save()
|
||||
core.info(`Saved golangci-lint analysis cache in ${Date.now() - startedAt}ms`)
|
||||
|
||||
const cacheDirs = [getLintCacheDir()]
|
||||
const primaryKey = core.getState(State.CachePrimaryKey)
|
||||
if (!primaryKey) {
|
||||
utils.logWarning(`Error retrieving key from state.`)
|
||||
return
|
||||
}
|
||||
|
||||
const state = utils.getCacheState()
|
||||
|
||||
if (utils.isExactKeyMatch(primaryKey, state)) {
|
||||
core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await cache.saveCache(cacheDirs, primaryKey)
|
||||
core.info(`Saved cache for golangci-lint from paths '${cacheDirs.join(`, `)}' in ${Date.now() - startedAt}ms`)
|
||||
} catch (error) {
|
||||
if (error.name === cache.ValidationError.name) {
|
||||
throw error
|
||||
} else if (error.name === cache.ReserveCacheError.name) {
|
||||
core.info(error.message)
|
||||
} else {
|
||||
core.info(`[warning] ${error.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
src/constants.ts
Normal file
18
src/constants.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export enum Inputs {
|
||||
Key = "key",
|
||||
Path = "path",
|
||||
RestoreKeys = "restore-keys",
|
||||
}
|
||||
|
||||
export enum State {
|
||||
CachePrimaryKey = "CACHE_KEY",
|
||||
CacheMatchedKey = "CACHE_RESULT",
|
||||
}
|
||||
|
||||
export enum Events {
|
||||
Key = "GITHUB_EVENT_NAME",
|
||||
Push = "push",
|
||||
PullRequest = "pull_request",
|
||||
}
|
||||
|
||||
export const RefKey = "GITHUB_REF"
|
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
|
||||
|
189
src/install.ts
189
src/install.ts
@ -1,27 +1,180 @@
|
||||
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 which from "which"
|
||||
|
||||
import { stringifyVersion, Version } from "./version"
|
||||
import { getVersion, VersionInfo } from "./version"
|
||||
|
||||
// The installLint returns path to installed binary of golangci-lint.
|
||||
export async function installLint(ver: Version): Promise<string> {
|
||||
core.info(`Installing golangci-lint ${stringifyVersion(ver)}...`)
|
||||
const startedAt = Date.now()
|
||||
const dirName = `golangci-lint-${ver.major}.${ver.minor}.${ver.patch}-linux-amd64`
|
||||
const assetUrl = `https://github.com/golangci/golangci-lint/releases/download/${stringifyVersion(ver)}/${dirName}.tar.gz`
|
||||
const execShellCommand = promisify(exec)
|
||||
|
||||
const tarGzPath = await tc.downloadTool(assetUrl)
|
||||
const extractedDir = await tc.extractTar(tarGzPath, process.env.HOME)
|
||||
const lintPath = path.join(extractedDir, dirName, `golangci-lint`)
|
||||
core.info(`Installed golangci-lint into ${lintPath} in ${Date.now() - startedAt}ms`)
|
||||
return lintPath
|
||||
export enum InstallMode {
|
||||
Binary = "binary",
|
||||
GoInstall = "goinstall",
|
||||
None = "none",
|
||||
}
|
||||
|
||||
export async function installGo(): Promise<void> {
|
||||
const startedAt = Date.now()
|
||||
process.env[`INPUT_GO-VERSION`] = `1`
|
||||
await setupGo()
|
||||
core.info(`Installed Go in ${Date.now() - startedAt}ms`)
|
||||
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.
|
||||
*
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
export async function install(): Promise<string> {
|
||||
const mode = core.getInput("install-mode").toLowerCase()
|
||||
|
||||
if (mode === InstallMode.None) {
|
||||
const binPath = await which("golangci-lint", { nothrow: true })
|
||||
if (!binPath) {
|
||||
throw new Error("golangci-lint binary not found in the PATH")
|
||||
}
|
||||
return binPath
|
||||
}
|
||||
|
||||
const versionInfo = await getVersion(<InstallMode>mode)
|
||||
|
||||
return await installBinary(versionInfo, <InstallMode>mode)
|
||||
}
|
||||
|
||||
/**
|
||||
* Install golangci-lint.
|
||||
*
|
||||
* @param versionInfo information about version to install.
|
||||
* @param mode installation mode.
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
export async function installBinary(versionInfo: VersionInfo, mode: InstallMode): Promise<string> {
|
||||
core.info(`Installation mode: ${mode}`)
|
||||
|
||||
switch (mode) {
|
||||
case InstallMode.Binary:
|
||||
return installBin(versionInfo)
|
||||
case InstallMode.GoInstall:
|
||||
return goInstall(versionInfo)
|
||||
default:
|
||||
return installBin(versionInfo)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install golangci-lint via `go install`.
|
||||
*
|
||||
* @param versionInfo information about version to install.
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
async function goInstall(versionInfo: VersionInfo): Promise<string> {
|
||||
core.info(`Installing golangci-lint ${versionInfo.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/v2/cmd/golangci-lint@${versionInfo.TargetVersion}`,
|
||||
options
|
||||
)
|
||||
printOutput(exres)
|
||||
|
||||
const res = await execShellCommand(
|
||||
`go install -n github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${versionInfo.TargetVersion}`,
|
||||
options
|
||||
)
|
||||
printOutput(res)
|
||||
|
||||
// The output of `go install -n` when the binary is already installed is `touch <path_to_the_binary>`.
|
||||
const binPath = res.stderr
|
||||
.split(/\r?\n/)
|
||||
.map((v) => v.trimStart().trimEnd())
|
||||
.filter((v) => v.startsWith("touch "))
|
||||
.reduce((a, b) => a + b, "")
|
||||
.split(` `, 2)[1]
|
||||
|
||||
core.info(`Installed golangci-lint into ${binPath} in ${Date.now() - startedAt}ms`)
|
||||
|
||||
return binPath
|
||||
}
|
||||
|
||||
/**
|
||||
* Install golangci-lint via the precompiled binary.
|
||||
*
|
||||
* @param versionInfo information about version to install.
|
||||
* @returns path to installed binary of golangci-lint.
|
||||
*/
|
||||
async function installBin(versionInfo: VersionInfo): Promise<string> {
|
||||
core.info(`Installing golangci-lint binary ${versionInfo.TargetVersion}...`)
|
||||
|
||||
const startedAt = Date.now()
|
||||
|
||||
const assetURL = getAssetURL(versionInfo)
|
||||
|
||||
core.info(`Downloading binary ${assetURL} ...`)
|
||||
|
||||
const archivePath = await tc.downloadTool(assetURL)
|
||||
|
||||
let extractedDir = ""
|
||||
let repl = /\.tar\.gz$/
|
||||
if (assetURL.endsWith("zip")) {
|
||||
extractedDir = await tc.extractZip(archivePath, process.env.HOME)
|
||||
repl = /\.zip$/
|
||||
} else {
|
||||
// We want to always overwrite files if the local cache already has them
|
||||
const args = ["xz"]
|
||||
if (process.platform.toString() != "darwin") {
|
||||
args.push("--overwrite")
|
||||
}
|
||||
extractedDir = await tc.extractTar(archivePath, process.env.HOME, args)
|
||||
}
|
||||
|
||||
const urlParts = assetURL.split(`/`)
|
||||
const dirName = urlParts[urlParts.length - 1].replace(repl, ``)
|
||||
const binPath = path.join(extractedDir, dirName, `golangci-lint`)
|
||||
|
||||
core.info(`Installed golangci-lint into ${binPath} in ${Date.now() - startedAt}ms`)
|
||||
|
||||
return binPath
|
||||
}
|
||||
|
||||
function getAssetURL(versionInfo: VersionInfo): string {
|
||||
let ext = "tar.gz"
|
||||
|
||||
let platform = os.platform().toString()
|
||||
switch (platform) {
|
||||
case "win32":
|
||||
platform = "windows"
|
||||
ext = "zip"
|
||||
break
|
||||
}
|
||||
|
||||
let arch = os.arch()
|
||||
switch (arch) {
|
||||
case "arm64":
|
||||
arch = "arm64"
|
||||
break
|
||||
case "x64":
|
||||
arch = "amd64"
|
||||
break
|
||||
case "x32":
|
||||
case "ia32":
|
||||
arch = "386"
|
||||
break
|
||||
}
|
||||
|
||||
const noPrefix = versionInfo.TargetVersion.slice(1)
|
||||
|
||||
return `https://github.com/golangci/golangci-lint/releases/download/${versionInfo.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}`
|
||||
}
|
||||
|
120
src/patch.ts
Normal file
120
src/patch.ts
Normal file
@ -0,0 +1,120 @@
|
||||
import * as core from "@actions/core"
|
||||
import * as github from "@actions/github"
|
||||
import { Context } from "@actions/github/lib/context"
|
||||
import * as pluginRetry from "@octokit/plugin-retry"
|
||||
import fs from "fs"
|
||||
import path from "path"
|
||||
import { dir } from "tmp"
|
||||
import { promisify } from "util"
|
||||
|
||||
import { alterDiffPatch } from "./utils/diffUtils"
|
||||
|
||||
const writeFile = promisify(fs.writeFile)
|
||||
const createTempDir = promisify(dir)
|
||||
|
||||
export function isOnlyNewIssues(): boolean {
|
||||
return core.getBooleanInput(`only-new-issues`, { required: true })
|
||||
}
|
||||
|
||||
export async function fetchPatch(): Promise<string> {
|
||||
if (!isOnlyNewIssues()) {
|
||||
return ``
|
||||
}
|
||||
|
||||
const ctx = github.context
|
||||
|
||||
switch (ctx.eventName) {
|
||||
case `pull_request`:
|
||||
case `pull_request_target`:
|
||||
return await fetchPullRequestPatch(ctx)
|
||||
case `push`:
|
||||
return await fetchPushPatch(ctx)
|
||||
case `merge_group`:
|
||||
return ``
|
||||
default:
|
||||
core.info(`Not fetching patch for showing only new issues because it's not a pull request context: event name is ${ctx.eventName}`)
|
||||
return ``
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchPullRequestPatch(ctx: Context): Promise<string> {
|
||||
const pr = ctx.payload.pull_request
|
||||
if (!pr) {
|
||||
core.warning(`No pull request in context`)
|
||||
return ``
|
||||
}
|
||||
|
||||
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }), {}, pluginRetry.retry)
|
||||
|
||||
let patch: string
|
||||
try {
|
||||
const patchResp = await octokit.rest.pulls.get({
|
||||
owner: ctx.repo.owner,
|
||||
repo: ctx.repo.repo,
|
||||
[`pull_number`]: pr.number,
|
||||
mediaType: {
|
||||
format: `diff`,
|
||||
},
|
||||
})
|
||||
|
||||
if (patchResp.status !== 200) {
|
||||
core.warning(`failed to fetch pull request patch: response status is ${patchResp.status}`)
|
||||
return `` // don't fail the action, but analyze without patch
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
patch = patchResp.data as any
|
||||
} catch (err) {
|
||||
console.warn(`failed to fetch pull request patch:`, err)
|
||||
return `` // don't fail the action, but analyze without patch
|
||||
}
|
||||
|
||||
try {
|
||||
const tempDir = await createTempDir()
|
||||
const patchPath = path.join(tempDir, "pull.patch")
|
||||
core.info(`Writing patch to ${patchPath}`)
|
||||
await writeFile(patchPath, alterDiffPatch(patch))
|
||||
return patchPath
|
||||
} catch (err) {
|
||||
console.warn(`failed to save pull request patch:`, err)
|
||||
return `` // don't fail the action, but analyze without patch
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchPushPatch(ctx: Context): Promise<string> {
|
||||
const octokit = github.getOctokit(core.getInput(`github-token`, { required: true }), {}, pluginRetry.retry)
|
||||
|
||||
let patch: string
|
||||
try {
|
||||
const patchResp = await octokit.rest.repos.compareCommitsWithBasehead({
|
||||
owner: ctx.repo.owner,
|
||||
repo: ctx.repo.repo,
|
||||
basehead: `${ctx.payload.before}...${ctx.payload.after}`,
|
||||
mediaType: {
|
||||
format: `diff`,
|
||||
},
|
||||
})
|
||||
|
||||
if (patchResp.status !== 200) {
|
||||
core.warning(`failed to fetch push patch: response status is ${patchResp.status}`)
|
||||
return `` // don't fail the action, but analyze without patch
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
patch = patchResp.data as any
|
||||
} catch (err) {
|
||||
console.warn(`failed to fetch push patch:`, err)
|
||||
return `` // don't fail the action, but analyze without patch
|
||||
}
|
||||
|
||||
try {
|
||||
const tempDir = await createTempDir()
|
||||
const patchPath = path.join(tempDir, "push.patch")
|
||||
core.info(`Writing patch to ${patchPath}`)
|
||||
await writeFile(patchPath, alterDiffPatch(patch))
|
||||
return patchPath
|
||||
} catch (err) {
|
||||
console.warn(`failed to save pull request patch:`, err)
|
||||
return `` // don't fail the action, but analyze without patch
|
||||
}
|
||||
}
|
168
src/run.ts
168
src/run.ts
@ -1,32 +1,33 @@
|
||||
import * as core from "@actions/core"
|
||||
import { exec } from "child_process"
|
||||
import * as github from "@actions/github"
|
||||
import { exec, ExecOptions } from "child_process"
|
||||
import * as fs from "fs"
|
||||
import * as path from "path"
|
||||
import { promisify } from "util"
|
||||
|
||||
import { restoreCache, saveCache } from "./cache"
|
||||
import { installGo, installLint } from "./install"
|
||||
import { findLintVersion } from "./version"
|
||||
import { install } from "./install"
|
||||
import { fetchPatch, isOnlyNewIssues } from "./patch"
|
||||
|
||||
const execShellCommand = promisify(exec)
|
||||
|
||||
async function prepareLint(): Promise<string> {
|
||||
const lintVersion = await findLintVersion()
|
||||
return await installLint(lintVersion)
|
||||
type Env = {
|
||||
binPath: string
|
||||
patchPath: string
|
||||
}
|
||||
|
||||
async function prepareEnv(): Promise<string> {
|
||||
async function prepareEnv(): Promise<Env> {
|
||||
const startedAt = Date.now()
|
||||
|
||||
// Prepare cache, lint and go in parallel.
|
||||
const restoreCachePromise = restoreCache()
|
||||
const prepareLintPromise = prepareLint()
|
||||
const installGoPromise = installGo()
|
||||
await restoreCache()
|
||||
|
||||
const lintPath = await prepareLintPromise
|
||||
await installGoPromise
|
||||
await restoreCachePromise
|
||||
const binPath = await install()
|
||||
const patchPath = await fetchPatch()
|
||||
|
||||
core.info(`Prepared env in ${Date.now() - startedAt}ms`)
|
||||
return lintPath
|
||||
|
||||
return { binPath, patchPath }
|
||||
}
|
||||
|
||||
type ExecRes = {
|
||||
@ -43,28 +44,106 @@ const printOutput = (res: ExecRes): void => {
|
||||
}
|
||||
}
|
||||
|
||||
async function runLint(lintPath: string): Promise<void> {
|
||||
async function runLint(binPath: string, patchPath: string): Promise<void> {
|
||||
const debug = core.getInput(`debug`)
|
||||
if (debug.split(`,`).includes(`cache`)) {
|
||||
const res = await execShellCommand(`${lintPath} cache status`)
|
||||
const res = await execShellCommand(`${binPath} cache status`)
|
||||
printOutput(res)
|
||||
}
|
||||
|
||||
const args = core.getInput(`args`)
|
||||
if (args.includes(`-out-format`)) {
|
||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
||||
const userArgs = core.getInput(`args`)
|
||||
const addedArgs: string[] = []
|
||||
|
||||
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 problemMatchers = core.getBooleanInput(`problem-matchers`)
|
||||
|
||||
if (problemMatchers) {
|
||||
const matchersPath = path.join(__dirname, "../..", "problem-matchers.json")
|
||||
if (fs.existsSync(matchersPath)) {
|
||||
// Adds problem matchers.
|
||||
// https://github.com/actions/setup-go/blob/cdcb36043654635271a94b9a6d1392de5bb323a7/src/main.ts#L81-L83
|
||||
core.info(`##[add-matcher]${matchersPath}`)
|
||||
}
|
||||
}
|
||||
|
||||
const cmd = `${lintPath} run ${args}`.trimRight()
|
||||
core.info(`Running [${cmd}] ...`)
|
||||
if (isOnlyNewIssues()) {
|
||||
if (
|
||||
userArgNames.has(`new`) ||
|
||||
userArgNames.has(`new-from-rev`) ||
|
||||
userArgNames.has(`new-from-patch`) ||
|
||||
userArgNames.has(`new-from-merge-base`)
|
||||
) {
|
||||
throw new Error(`please, don't specify manually --new* args when requesting only new issues`)
|
||||
}
|
||||
|
||||
const ctx = github.context
|
||||
|
||||
core.info(`only new issues on ${ctx.eventName}: ${patchPath}`)
|
||||
|
||||
switch (ctx.eventName) {
|
||||
case `pull_request`:
|
||||
case `pull_request_target`:
|
||||
case `push`:
|
||||
if (patchPath) {
|
||||
addedArgs.push(`--new-from-patch=${patchPath}`)
|
||||
|
||||
// Override config values.
|
||||
addedArgs.push(`--new=false`)
|
||||
addedArgs.push(`--new-from-rev=`)
|
||||
addedArgs.push(`--new-from-merge-base=`)
|
||||
}
|
||||
break
|
||||
case `merge_group`:
|
||||
addedArgs.push(`--new-from-rev=${ctx.payload.merge_group.base_sha}`)
|
||||
|
||||
// Override config values.
|
||||
addedArgs.push(`--new=false`)
|
||||
addedArgs.push(`--new-from-patch=`)
|
||||
addedArgs.push(`--new-from-merge-base=`)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const cmdArgs: ExecOptions = {}
|
||||
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
if (workingDirectory) {
|
||||
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||
throw new Error(`working-directory (${workingDirectory}) was not a path`)
|
||||
}
|
||||
|
||||
if (!userArgNames.has(`path-prefix`) && !userArgNames.has(`path-mode`)) {
|
||||
addedArgs.push(`--path-mode=abs`)
|
||||
}
|
||||
|
||||
cmdArgs.cwd = path.resolve(workingDirectory)
|
||||
}
|
||||
|
||||
await runVerify(binPath, userArgsMap, cmdArgs)
|
||||
|
||||
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd()
|
||||
|
||||
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`)
|
||||
|
||||
const startedAt = Date.now()
|
||||
try {
|
||||
const res = await execShellCommand(cmd)
|
||||
const res = await execShellCommand(cmd, cmdArgs)
|
||||
printOutput(res)
|
||||
core.info(`golangci-lint found no issues`)
|
||||
} catch (exc) {
|
||||
// This logging passes issues to GitHub annotations but comments can be more convenient for some users.
|
||||
// TODO: support reviewdog or leaving comments by GitHub API.
|
||||
printOutput(exc)
|
||||
|
||||
if (exc.code === 1) {
|
||||
@ -77,10 +156,49 @@ async function runLint(lintPath: string): Promise<void> {
|
||||
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`)
|
||||
}
|
||||
|
||||
async function runVerify(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptions): Promise<void> {
|
||||
const verify = core.getBooleanInput(`verify`, { required: true })
|
||||
if (!verify) {
|
||||
return
|
||||
}
|
||||
|
||||
const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs)
|
||||
if (!cfgPath) {
|
||||
return
|
||||
}
|
||||
|
||||
let cmdVerify = `${binPath} config verify`
|
||||
if (userArgsMap.get("config")) {
|
||||
cmdVerify += ` --config=${userArgsMap.get("config")}`
|
||||
}
|
||||
|
||||
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`)
|
||||
|
||||
const res = await execShellCommand(cmdVerify, cmdArgs)
|
||||
printOutput(res)
|
||||
}
|
||||
|
||||
async function getConfigPath(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptions): Promise<string> {
|
||||
let cmdConfigPath = `${binPath} config path`
|
||||
if (userArgsMap.get("config")) {
|
||||
cmdConfigPath += ` --config=${userArgsMap.get("config")}`
|
||||
}
|
||||
|
||||
core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`)
|
||||
|
||||
try {
|
||||
const resPath = await execShellCommand(cmdConfigPath, cmdArgs)
|
||||
return resPath.stderr.trim()
|
||||
} catch {
|
||||
return ``
|
||||
}
|
||||
}
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const lintPath = await core.group(`prepare environment`, prepareEnv)
|
||||
await core.group(`run golangci-lint`, () => runLint(lintPath))
|
||||
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv)
|
||||
core.addPath(path.dirname(binPath))
|
||||
await core.group(`run golangci-lint`, () => runLint(binPath, patchPath))
|
||||
} catch (error) {
|
||||
core.error(`Failed to run: ${error}, ${error.stack}`)
|
||||
core.setFailed(error.message)
|
||||
|
37
src/utils/actionUtils.ts
Normal file
37
src/utils/actionUtils.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import * as core from "@actions/core"
|
||||
|
||||
import { RefKey, State } from "../constants"
|
||||
|
||||
export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
|
||||
return !!(
|
||||
cacheKey &&
|
||||
cacheKey.localeCompare(key, undefined, {
|
||||
sensitivity: "accent",
|
||||
}) === 0
|
||||
)
|
||||
}
|
||||
|
||||
export function setCacheState(state: string): void {
|
||||
core.saveState(State.CacheMatchedKey, state)
|
||||
}
|
||||
|
||||
export function getCacheState(): string | undefined {
|
||||
const cacheKey = core.getState(State.CacheMatchedKey)
|
||||
if (cacheKey) {
|
||||
core.debug(`Cache state/key: ${cacheKey}`)
|
||||
return cacheKey
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function logWarning(message: string): void {
|
||||
const warningPrefix = "[warning]"
|
||||
core.info(`${warningPrefix}${message}`)
|
||||
}
|
||||
|
||||
// Cache token authorized for all events that are tied to a ref
|
||||
// See GitHub Context https://help.github.com/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#github-context
|
||||
export function isValidEvent(): boolean {
|
||||
return RefKey in process.env && Boolean(process.env[RefKey])
|
||||
}
|
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
|
||||
}
|
196
src/version.ts
196
src/version.ts
@ -1,40 +1,34 @@
|
||||
import * as core from "@actions/core"
|
||||
import * as github from "@actions/github"
|
||||
import { Octokit } from "@actions/github/node_modules/@octokit/rest"
|
||||
import * as httpm from "@actions/http-client"
|
||||
import * as fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
async function performResilientGitHubRequest<T>(opName: string, execFn: () => Promise<Octokit.Response<T>>): Promise<T> {
|
||||
let lastError = ``
|
||||
for (let i = 0; i < 3; i++) {
|
||||
// TODO: configurable params, timeouts, random jitters, exponential back-off, etc
|
||||
try {
|
||||
const res = await execFn()
|
||||
if (res.status === 200) {
|
||||
return res.data
|
||||
}
|
||||
lastError = `GitHub returned HTTP code ${res.status}`
|
||||
} catch (exc) {
|
||||
lastError = exc.message
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`failed to execute github operation '${opName}': ${lastError}`)
|
||||
}
|
||||
import { InstallMode } from "./install"
|
||||
|
||||
// TODO: make a class
|
||||
export type Version = {
|
||||
major: number
|
||||
minor: number
|
||||
patch: number | null
|
||||
}
|
||||
} | null
|
||||
|
||||
const versionRe = /^v(\d+)\.(\d+)(?:\.(\d+))?$/
|
||||
const modVersionRe = /github.com\/golangci\/golangci-lint\/v2\s(v\S+)/
|
||||
|
||||
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`)
|
||||
}
|
||||
|
||||
if (parseInt(match[1]) !== 2) {
|
||||
throw new Error(`invalid version string '${s}', golangci-lint v${match[1]} is not supported by golangci-lint-action >= v7.`)
|
||||
}
|
||||
|
||||
return {
|
||||
major: parseInt(match[1]),
|
||||
minor: parseInt(match[2]),
|
||||
@ -42,82 +36,140 @@ const parseVersion = (s: string): Version => {
|
||||
}
|
||||
}
|
||||
|
||||
export const stringifyVersion = (v: Version): string => `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}`
|
||||
export const stringifyVersion = (v: Version): string => {
|
||||
if (v == null) {
|
||||
return "latest"
|
||||
}
|
||||
return `v${v.major}.${v.minor}${v.patch !== null ? `.${v.patch}` : ``}`
|
||||
}
|
||||
|
||||
const minVersion = {
|
||||
major: 1,
|
||||
minor: 14,
|
||||
major: 2,
|
||||
minor: 1,
|
||||
patch: 0,
|
||||
}
|
||||
|
||||
const isLessVersion = (a: Version, b: Version): boolean => {
|
||||
if (a == null) {
|
||||
return true
|
||||
}
|
||||
if (b == null) {
|
||||
return false
|
||||
}
|
||||
if (a.major != b.major) {
|
||||
return a.major < b.major
|
||||
}
|
||||
|
||||
if (a.minor != b.minor) {
|
||||
return a.minor < b.minor
|
||||
}
|
||||
|
||||
if (a.patch === null || b.patch === null) {
|
||||
return true
|
||||
}
|
||||
|
||||
return a.patch < b.patch
|
||||
// Do not compare patch parts because if the min version has a non-zero value
|
||||
// then it returns false, since the patch version of requested is always zero
|
||||
return a.minor < b.minor
|
||||
}
|
||||
|
||||
const getRequestedLintVersion = (): Version => {
|
||||
const requestedLintVersion = core.getInput(`version`, { required: true })
|
||||
const parsedRequestedLintVersion = parseVersion(requestedLintVersion)
|
||||
if (parsedRequestedLintVersion.patch !== null) {
|
||||
throw new Error(
|
||||
`requested golangci-lint version '${requestedLintVersion}' was specified with the patch version, need specify only minor version`
|
||||
)
|
||||
const getRequestedVersion = (): Version => {
|
||||
let requestedVersion = core.getInput(`version`)
|
||||
const workingDirectory = core.getInput(`working-directory`)
|
||||
|
||||
let goMod = "go.mod"
|
||||
if (workingDirectory) {
|
||||
goMod = path.join(workingDirectory, goMod)
|
||||
}
|
||||
if (isLessVersion(parsedRequestedLintVersion, minVersion)) {
|
||||
|
||||
if (requestedVersion == "" && fs.existsSync(goMod)) {
|
||||
const content = fs.readFileSync(goMod, "utf-8")
|
||||
const match = content.match(modVersionRe)
|
||||
if (match) {
|
||||
requestedVersion = match[1]
|
||||
core.info(`Found golangci-lint version '${requestedVersion}' in '${goMod}' file`)
|
||||
}
|
||||
}
|
||||
|
||||
const parsedRequestedVersion = parseVersion(requestedVersion)
|
||||
if (parsedRequestedVersion == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
if (isLessVersion(parsedRequestedVersion, minVersion)) {
|
||||
throw new Error(
|
||||
`requested golangci-lint version '${requestedLintVersion}' isn't supported: we support only ${stringifyVersion(
|
||||
`requested golangci-lint version '${requestedVersion}' isn't supported: we support only ${stringifyVersion(
|
||||
minVersion
|
||||
)} and later versions`
|
||||
)
|
||||
}
|
||||
return parsedRequestedLintVersion
|
||||
|
||||
return parsedRequestedVersion
|
||||
}
|
||||
|
||||
export async function findLintVersion(): Promise<Version> {
|
||||
core.info(`Finding needed golangci-lint version...`)
|
||||
const startedAt = Date.now()
|
||||
const reqLintVersion = getRequestedLintVersion()
|
||||
export type VersionInfo = {
|
||||
Error?: string
|
||||
TargetVersion: string
|
||||
}
|
||||
|
||||
const githubToken = core.getInput(`github-token`, { required: true })
|
||||
const octokit = new github.GitHub(githubToken)
|
||||
type VersionMapping = {
|
||||
MinorVersionToConfig: {
|
||||
[minorVersion: string]: VersionInfo
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: fetch all pages, not only the first one.
|
||||
const releasesPage = await performResilientGitHubRequest(`fetch releases of golangci-lint`, function() {
|
||||
return octokit.repos.listReleases({ owner: `golangci`, repo: `golangci-lint`, [`per_page`]: 100 })
|
||||
const fetchVersionMapping = async (): Promise<VersionMapping> => {
|
||||
const http = new httpm.HttpClient(`golangci/golangci-lint-action`, [], {
|
||||
allowRetries: true,
|
||||
maxRetries: 5,
|
||||
})
|
||||
|
||||
// TODO: use semver and semver.satisfies
|
||||
let latestPatchVersion: number | null = null
|
||||
for (const rel of releasesPage) {
|
||||
const ver = parseVersion(rel.tag_name)
|
||||
if (ver.patch === null) {
|
||||
// < minVersion
|
||||
continue
|
||||
try {
|
||||
const url = `https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/assets/github-action-config-v2.json`
|
||||
const response: httpm.HttpClientResponse = await http.get(url)
|
||||
if (response.message.statusCode !== 200) {
|
||||
throw new Error(`failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`)
|
||||
}
|
||||
|
||||
if (ver.major == reqLintVersion.major && ver.minor == reqLintVersion.minor) {
|
||||
latestPatchVersion = latestPatchVersion !== null ? Math.max(latestPatchVersion, ver.patch) : ver.patch
|
||||
}
|
||||
const body = await response.readBody()
|
||||
return JSON.parse(body)
|
||||
} catch (exc) {
|
||||
throw new Error(`failed to get action config: ${exc.message}`)
|
||||
}
|
||||
|
||||
if (latestPatchVersion === null) {
|
||||
throw new Error(
|
||||
`requested golangci-lint lint version ${stringifyVersion(reqLintVersion)} doesn't exist in list of golangci-lint releases`
|
||||
)
|
||||
}
|
||||
|
||||
const neededVersion = { ...reqLintVersion, patch: latestPatchVersion }
|
||||
core.info(`Calculated needed golangci-lint version ${stringifyVersion(neededVersion)} in ${Date.now() - startedAt}ms`)
|
||||
return neededVersion
|
||||
}
|
||||
|
||||
export async function getVersion(mode: InstallMode): Promise<VersionInfo> {
|
||||
core.info(`Finding needed golangci-lint version...`)
|
||||
|
||||
if (mode == InstallMode.GoInstall) {
|
||||
const v: string = core.getInput(`version`)
|
||||
|
||||
return { TargetVersion: v ? v : "latest" }
|
||||
}
|
||||
|
||||
const reqVersion = getRequestedVersion()
|
||||
|
||||
// if the patched version is passed, just use it
|
||||
if (reqVersion?.major === 2 && reqVersion?.minor != null && reqVersion?.patch !== null) {
|
||||
return new Promise((resolve) => {
|
||||
const versionWithoutV = `${reqVersion.major}.${reqVersion.minor}.${reqVersion.patch}`
|
||||
resolve({ TargetVersion: `v${versionWithoutV}` })
|
||||
})
|
||||
}
|
||||
|
||||
const startedAt = Date.now()
|
||||
|
||||
const mapping = await fetchVersionMapping()
|
||||
if (!mapping.MinorVersionToConfig) {
|
||||
core.warning(JSON.stringify(mapping))
|
||||
throw new Error(`invalid config: no MinorVersionToConfig field`)
|
||||
}
|
||||
|
||||
const versionInfo = mapping.MinorVersionToConfig[stringifyVersion(reqVersion)]
|
||||
if (!versionInfo) {
|
||||
throw new Error(`requested golangci-lint version '${stringifyVersion(reqVersion)}' doesn't exist`)
|
||||
}
|
||||
|
||||
if (versionInfo.Error) {
|
||||
throw new Error(`failed to use requested golangci-lint version '${stringifyVersion(reqVersion)}': ${versionInfo.Error}`)
|
||||
}
|
||||
|
||||
core.info(
|
||||
`Requested golangci-lint '${stringifyVersion(reqVersion)}', using '${versionInfo.TargetVersion}', calculation took ${
|
||||
Date.now() - startedAt
|
||||
}ms`
|
||||
)
|
||||
|
||||
return versionInfo
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 90 KiB |
BIN
static/colored-line-number.png
Normal file
BIN
static/colored-line-number.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
@ -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