Staticcheck: vendor/k8s.io/kubectl/pkg/cmd/exec|config|certificates

Kubernetes-commit: a14ceeb2c00d8048ce05ad199c919bdab6fb6954
This commit is contained in:
drfish 2020-01-23 14:03:11 +08:00 committed by Kubernetes Publisher
parent c7c9f278ae
commit 5aa1be61e1
6 changed files with 8 additions and 12 deletions

View File

@ -234,7 +234,7 @@ func (o *CertificateOptions) modifyCertificateCondition(builder *resource.Builde
csr := info.Object.(*certificatesv1beta1.CertificateSigningRequest)
csr, hasCondition := modify(csr)
if !hasCondition || force {
csr, err = clientSet.CertificateSigningRequests().UpdateApproval(csr)
_, err = clientSet.CertificateSigningRequests().UpdateApproval(csr)
if errors.IsConflict(err) && i < 10 {
if err := info.Get(); err != nil {
return err

View File

@ -37,7 +37,6 @@ import (
type createAuthInfoOptions struct {
configAccess clientcmd.ConfigAccess
name string
authPath cliflag.StringFlag
clientCertificate cliflag.StringFlag
clientKey cliflag.StringFlag
token cliflag.StringFlag

View File

@ -92,13 +92,6 @@ func (s *navigationSteps) pop() navigationStep {
return navigationStep{}
}
func (s *navigationSteps) peek() navigationStep {
if s.moreStepsRemaining() {
return s.steps[s.currentStepIndex]
}
return navigationStep{}
}
func (s *navigationSteps) moreStepsRemaining() bool {
return len(s.steps) > s.currentStepIndex
}

View File

@ -125,6 +125,9 @@ func (test unsetConfigTest) run(t *testing.T) {
if err == nil {
err = opts.run(buf)
}
if test.expectedErr == "" && err != nil {
t.Fatalf("unexpected error: %v", err)
}
config, err := clientcmd.LoadFromFile(fakeKubeFile.Name())
if err != nil {
t.Fatalf("unexpected error loading kubeconfig file: %v", err)

View File

@ -65,8 +65,6 @@ var (
# Get the password for the e2e user
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'`)
defaultOutputFormat = "yaml"
)
// NewCmdConfigView returns a Command instance for 'config view' sub command

View File

@ -148,6 +148,9 @@ func TestPodAndContainer(t *testing.T) {
options.ErrOut = bytes.NewBuffer([]byte{})
options.Out = bytes.NewBuffer([]byte{})
err = options.Complete(tf, cmd, test.args, test.argsLenAtDash)
if !test.expectError && err != nil {
t.Errorf("%s: unexpected error: %v", test.name, err)
}
err = options.Validate()
if test.expectError && err == nil {
@ -160,7 +163,7 @@ func TestPodAndContainer(t *testing.T) {
return
}
pod, err := options.ExecutablePodFn(tf, test.obj, defaultPodExecTimeout)
pod, _ := options.ExecutablePodFn(tf, test.obj, defaultPodExecTimeout)
if pod.Name != test.expectedPod {
t.Errorf("%s: expected: %s, got: %s", test.name, test.expectedPod, options.PodName)
}