mirror of
https://github.com/helm/helm.git
synced 2026-03-21 01:50:29 -04:00
fix(cmd): errorlint linter
#### Description errorlint linter in cmd/helm Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
9b22aa4e05
commit
edbd705bd0
2 changed files with 6 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package main // import "helm.sh/helm/v4/cmd/helm"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
|
|
@ -41,7 +42,8 @@ func main() {
|
|||
}
|
||||
|
||||
if err := cmd.Execute(); err != nil {
|
||||
if cerr, ok := err.(helmcmd.CommandError); ok {
|
||||
var cerr helmcmd.CommandError
|
||||
if errors.As(err, &cerr) {
|
||||
os.Exit(cerr.ExitCode)
|
||||
}
|
||||
os.Exit(1)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
|
|
@ -60,7 +61,8 @@ func TestCliPluginExitCode(t *testing.T) {
|
|||
cmd.Stderr = stderr
|
||||
err := cmd.Run()
|
||||
|
||||
exiterr, ok := err.(*exec.ExitError)
|
||||
exiterr := &exec.ExitError{}
|
||||
ok := errors.As(err, &exiterr)
|
||||
if !ok {
|
||||
t.Fatalf("Unexpected error type returned by os.Exit: %T", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue