mirror of
https://github.com/helm/helm.git
synced 2026-06-30 19:57:48 +00: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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user