Commit d445d0e
chore: enable errcheck, nolintlint, and nilnil linters (#3122)
* Enable three new golangci-lint checks to improve error handling and code quality.
Ensures all error returns are explicitly handled or intentionally ignored to prevent silent failures.
**Fixed:**
- `internal/sanitizer/sanitizer.go` - Wrapped async audit logging in closure to explicitly discard error. Audit logging is fire-and-forget to avoid blocking sanitization.
Functions returning `(nil, nil)` are ambiguous - callers cannot distinguish between success-with-no-data and error states.
**Fixed:**
- `pkg/common/cluster/clusterutil.go` - Removed special handling of `ErrReserveFull`. Library code now reports all errors naturally using `%w` for proper error wrapping.
- `cmd/osde2e/provision/cmd.go` - Handles `ErrReserveFull` at application boundary where business logic belongs. Treats "reserve full" as success, all other errors propagate.
- `pkg/e2e/e2e.go` + `pkg/common/aws/s3.go` - Moved S3 bucket check to caller. Application layer decides whether to upload; library layer just uploads. Added TODO for future refactor to use
dependency injection.
- `test/sdn_migration/sdn_migration_test.go` - Changed terraform destroy to return empty map instead of `(nil, nil)` to indicate success-with-no-output.
Ensures linter suppressions are properly formatted and prevents malformed directives.
**Fixed:**
- `pkg/common/providers/ocmprovider/cluster.go` - Fixed `//nolint:gocyclo` formatting (removed space).
- `pkg/common/concurrentviper/generated.go` - Removed malformed `// nolint` directive. File is already excluded via config since generator is broken.
- `cmd/osde2e/provision/cmd.go` - Removed unnecessary `//nolint:gocyclo` directive. Function complexity was reduced.
- **Clearer error contracts** - No more ambiguous (nil, nil) returns
- **Better separation of concerns** - Libraries report errors, applications interpret them
- **Explicit error handling** - All errors are handled or intentionally discarded
- **Type-safe error wrapping** - Using `%w` instead of `%v` for proper error chains
All changes maintain existing behavior while making error handling more explicit and maintainable.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: add ReserveFull error logging back
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 6647d48 commit d445d0e
10 files changed
Lines changed: 35 additions & 39 deletions
File tree
- cmd/osde2e/provision
- internal/sanitizer
- pkg
- common
- aws
- cluster
- concurrentviper
- providers/ocmprovider
- e2e
- test/sdn_migration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | | - | |
18 | 20 | | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
83 | | - | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
96 | 99 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
143 | 147 | | |
144 | 148 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | 71 | | |
84 | 72 | | |
85 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
573 | 572 | | |
574 | | - | |
| 573 | + | |
575 | 574 | | |
576 | 575 | | |
577 | 576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
258 | 256 | | |
259 | 257 | | |
260 | 258 | | |
261 | 259 | | |
262 | 260 | | |
263 | 261 | | |
264 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
265 | 268 | | |
266 | 269 | | |
267 | 270 | | |
268 | 271 | | |
269 | 272 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
267 | 268 | | |
268 | 269 | | |
269 | 270 | | |
270 | | - | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| |||
0 commit comments