Skip to content

Commit a14ceeb

Browse files
committed
Staticcheck: vendor/k8s.io/kubectl/pkg/cmd/exec|config|certificates
1 parent 50fa183 commit a14ceeb

File tree

7 files changed

+8
-15
lines changed

7 files changed

+8
-15
lines changed

hack/.staticcheck_failures

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ vendor/k8s.io/client-go/restmapper
103103
vendor/k8s.io/client-go/tools/leaderelection
104104
vendor/k8s.io/client-go/transport
105105
vendor/k8s.io/component-base/metrics
106-
vendor/k8s.io/kubectl/pkg/cmd/certificates
107-
vendor/k8s.io/kubectl/pkg/cmd/config
108106
vendor/k8s.io/kubectl/pkg/cmd/edit
109-
vendor/k8s.io/kubectl/pkg/cmd/exec
110107
vendor/k8s.io/kubectl/pkg/cmd/get
111108
vendor/k8s.io/kubectl/pkg/cmd/proxy
112109
vendor/k8s.io/kubectl/pkg/cmd/rollingupdate

staging/src/k8s.io/kubectl/pkg/cmd/certificates/certificates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (o *CertificateOptions) modifyCertificateCondition(builder *resource.Builde
234234
csr := info.Object.(*certificatesv1beta1.CertificateSigningRequest)
235235
csr, hasCondition := modify(csr)
236236
if !hasCondition || force {
237-
csr, err = clientSet.CertificateSigningRequests().UpdateApproval(csr)
237+
_, err = clientSet.CertificateSigningRequests().UpdateApproval(csr)
238238
if errors.IsConflict(err) && i < 10 {
239239
if err := info.Get(); err != nil {
240240
return err

staging/src/k8s.io/kubectl/pkg/cmd/config/create_authinfo.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
type createAuthInfoOptions struct {
3838
configAccess clientcmd.ConfigAccess
3939
name string
40-
authPath cliflag.StringFlag
4140
clientCertificate cliflag.StringFlag
4241
clientKey cliflag.StringFlag
4342
token cliflag.StringFlag

staging/src/k8s.io/kubectl/pkg/cmd/config/navigation_step_parser.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,6 @@ func (s *navigationSteps) pop() navigationStep {
9292
return navigationStep{}
9393
}
9494

95-
func (s *navigationSteps) peek() navigationStep {
96-
if s.moreStepsRemaining() {
97-
return s.steps[s.currentStepIndex]
98-
}
99-
return navigationStep{}
100-
}
101-
10295
func (s *navigationSteps) moreStepsRemaining() bool {
10396
return len(s.steps) > s.currentStepIndex
10497
}

staging/src/k8s.io/kubectl/pkg/cmd/config/unset_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ func (test unsetConfigTest) run(t *testing.T) {
125125
if err == nil {
126126
err = opts.run(buf)
127127
}
128+
if test.expectedErr == "" && err != nil {
129+
t.Fatalf("unexpected error: %v", err)
130+
}
128131
config, err := clientcmd.LoadFromFile(fakeKubeFile.Name())
129132
if err != nil {
130133
t.Fatalf("unexpected error loading kubeconfig file: %v", err)

staging/src/k8s.io/kubectl/pkg/cmd/config/view.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ var (
6565
6666
# Get the password for the e2e user
6767
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'`)
68-
69-
defaultOutputFormat = "yaml"
7068
)
7169

7270
// NewCmdConfigView returns a Command instance for 'config view' sub command

staging/src/k8s.io/kubectl/pkg/cmd/exec/exec_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ func TestPodAndContainer(t *testing.T) {
148148
options.ErrOut = bytes.NewBuffer([]byte{})
149149
options.Out = bytes.NewBuffer([]byte{})
150150
err = options.Complete(tf, cmd, test.args, test.argsLenAtDash)
151+
if !test.expectError && err != nil {
152+
t.Errorf("%s: unexpected error: %v", test.name, err)
153+
}
151154
err = options.Validate()
152155

153156
if test.expectError && err == nil {
@@ -160,7 +163,7 @@ func TestPodAndContainer(t *testing.T) {
160163
return
161164
}
162165

163-
pod, err := options.ExecutablePodFn(tf, test.obj, defaultPodExecTimeout)
166+
pod, _ := options.ExecutablePodFn(tf, test.obj, defaultPodExecTimeout)
164167
if pod.Name != test.expectedPod {
165168
t.Errorf("%s: expected: %s, got: %s", test.name, test.expectedPod, options.PodName)
166169
}

0 commit comments

Comments
 (0)