Check correct variable after current namespace retrieval (#287)

This commit is contained in:
Jeff MAURY 2021-02-01 02:48:35 +01:00 committed by GitHub
parent 438ba19fb0
commit 767218a9a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,8 +51,8 @@ func switchNamespace(kc *kubeconfig.Kubeconfig, ns string) (string, error) {
return "", errors.New("current-context is not set")
}
curNS, err := kc.NamespaceOfContext(ctx)
if ctx == "" {
return "", errors.New("failed to get current namespace")
if err != nil {
return "", errors.Wrap(err, "failed to get current namespace")
}
f := NewNSFile(ctx)