fix(cmd): errorlint linter

#### Description

errorlint linter in cmd/helm

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
pull/31805/head
Matthieu MOREL 4 days ago
parent 9b22aa4e05
commit edbd705bd0

@ -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…
Cancel
Save