Commit 9b08ea2
authored
ci: add golangci-lint and fix all reported issues (#6)
Adopt the maratori "golden config" (golangci-lint v2.7.1) and run it in CI
via a new lint job in build.yml. Only deviation from the upstream config is
local-prefixes set to the module path.
Resolve every issue the config reports (108 -> 0) in code, with no config
relaxations and no nolint directives:
- Extract generic polling helpers (pollUntilReady, pollUntilGone,
deleteAndWait, diffStrings) in provider/util.go, collapsing the repetitive
per-resource Create/Delete closures. This clears dupl, most govet shadow
hits, and gocognit on vmResource.Update.
- Split the mock HTTP wiring funcs into one method per handler to bring
cognitive complexity under threshold (wireVMs was 62).
- Move the mock publicIPCounter onto the Server struct (gochecknoglobals).
- Introduce named constants for mode/status strings and magic numbers; add
json tags for musttag.
- Move validator tests to an external _test package; rename util_test.go to
util_internal_test.go (it needs an unexported symbol).
Behavior is preserved; the full test suite, go vet, gofmt and the docs-stale
check all pass. SG delete now detects terminal-failure status via the shared
pollUntilGone helper, matching the other resources.1 parent 122f77a commit 9b08ea2
37 files changed
Lines changed: 1828 additions & 920 deletions
File tree
- .github/workflows
- internal
- client
- mock
- provider
- acctest
- validators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
10 | 23 | | |
11 | 24 | | |
12 | 25 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| |||
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
41 | | - | |
| 50 | + | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
| |||
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | | - | |
| 111 | + | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
| |||
125 | 134 | | |
126 | 135 | | |
127 | 136 | | |
128 | | - | |
129 | | - | |
| 137 | + | |
| 138 | + | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| |||
443 | 452 | | |
444 | 453 | | |
445 | 454 | | |
446 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
447 | 463 | | |
448 | 464 | | |
449 | 465 | | |
| |||
490 | 506 | | |
491 | 507 | | |
492 | 508 | | |
493 | | - | |
| 509 | + | |
494 | 510 | | |
495 | 511 | | |
496 | 512 | | |
497 | 513 | | |
498 | 514 | | |
499 | 515 | | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
| 516 | + | |
| 517 | + | |
504 | 518 | | |
505 | 519 | | |
506 | 520 | | |
| |||
594 | 608 | | |
595 | 609 | | |
596 | 610 | | |
| 611 | + | |
597 | 612 | | |
598 | 613 | | |
599 | 614 | | |
| |||
731 | 746 | | |
732 | 747 | | |
733 | 748 | | |
734 | | - | |
| 749 | + | |
735 | 750 | | |
736 | 751 | | |
737 | 752 | | |
| |||
752 | 767 | | |
753 | 768 | | |
754 | 769 | | |
755 | | - | |
| 770 | + | |
756 | 771 | | |
757 | 772 | | |
758 | 773 | | |
| |||
761 | 776 | | |
762 | 777 | | |
763 | 778 | | |
764 | | - | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
765 | 783 | | |
766 | 784 | | |
767 | 785 | | |
| |||
795 | 813 | | |
796 | 814 | | |
797 | 815 | | |
798 | | - | |
| 816 | + | |
799 | 817 | | |
800 | 818 | | |
801 | 819 | | |
| |||
851 | 869 | | |
852 | 870 | | |
853 | 871 | | |
854 | | - | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
855 | 877 | | |
856 | 878 | | |
857 | 879 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
76 | | - | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
0 commit comments