Commit a5b5610
authored
🌱 Add linter to show nil panic. (#1960)
* 🌱 Add linter to show nil panic.
The code contained an obvious nil panic on err.Error()
```go
err = action.Error()
if err != nil {
err = fmt.Errorf("action %+v failed (wait for rescue enabled): %w", action, err)
s.scope.Error(err, "")
err := s.scope.SetErrorAndRemediate(ctx, err.Error())
if err != nil {
return reconcile.Result{}, err
}
conditions.MarkFalse(hm, infrav1.ServerProvisionedCondition,
"EnablingRescueActionFailed", clusterv1.ConditionSeverityWarning,
"%s", err.Error())
return reconcile.Result{}, nil
}
```
No linter complained up to now.
Govet nilness does detect that now.
* Fix lint findings
* Fix CI failures
* Revert "Fix CI failures"
This reverts commit 3028076.
* Revert "Fix lint findings"
This reverts commit d7cd79b.
* Fix rescue action nil panic1 parent 59d4654 commit a5b5610
2 files changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| 452 | + | |
452 | 453 | | |
453 | | - | |
454 | | - | |
455 | | - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
459 | | - | |
| 460 | + | |
460 | 461 | | |
461 | 462 | | |
462 | 463 | | |
| |||
0 commit comments