mirror of
https://github.com/kubernetes/kubectl.git
synced 2026-05-28 04:35:50 -04:00
* kubectl: use %w for error wrapping and remove redundant .Error() calls Replace fmt.Errorf with %s and err.Error() with idiomatic %w wrapping in kubectl's polymorphichelpers, wait, and drain packages. This enables proper error chain inspection via errors.Is/As and follows Go best practices. Also fixes a typo: "Statefulset" -> "StatefulSet" in history.go. * Address review: use %w for error wrapping in extendErrWaitTimeout Use fmt.Errorf with %w instead of %v to preserve the error chain, allowing wait.Interrupted() to correctly detect timeout errors. Signed-off-by: supermario_leo <leo.stack@outlook.com> * Fix lint: wrap both errors with %w in cordon error path The linter flags err used with %v when it is an error type. Since Go 1.20+ supports multiple %w verbs in a single fmt.Errorf call, wrap both err and patchErr to preserve both error chains. Signed-off-by: supermario_leo <leo.stack@outlook.com> --------- Signed-off-by: supermario_leo <leo.stack@outlook.com> Kubernetes-commit: d916c320deb859cd264354c48f3bd5419f7a2950 |
||
|---|---|---|
| .. | ||
| condition.go | ||
| create.go | ||
| delete.go | ||
| json.go | ||
| wait.go | ||
| wait_test.go | ||