diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index 8a5700b814f..754de9bb8b7 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -15,8 +15,6 @@ pkg/controller/podgc pkg/controller/replicaset pkg/controller/resourcequota pkg/controller/statefulset -pkg/credentialprovider -pkg/credentialprovider/aws pkg/kubeapiserver/admission pkg/kubelet/apis/podresources pkg/kubelet/cm/devicemanager diff --git a/pkg/credentialprovider/aws/aws_credentials_test.go b/pkg/credentialprovider/aws/aws_credentials_test.go index 7161fc136d1..47b4958a011 100644 --- a/pkg/credentialprovider/aws/aws_credentials_test.go +++ b/pkg/credentialprovider/aws/aws_credentials_test.go @@ -196,7 +196,7 @@ func TestECRProvide(t *testing.T) { // Verify that we get an error for other images. for _, otherRegistry := range otherRegistries { image = path.Join(otherRegistry, "foo/bar") - creds, ok = keyring.Lookup(image) + _, ok = keyring.Lookup(image) if ok { t.Errorf("Unexpectedly found image: %s", image) return @@ -293,7 +293,7 @@ func TestChinaECRProvide(t *testing.T) { // Verify that we get an error for other images. for _, otherRegistry := range otherRegistries { image = path.Join(otherRegistry, image) - creds, ok = keyring.Lookup(image) + _, ok = keyring.Lookup(image) if ok { t.Errorf("Unexpectedly found image: %s", image) return diff --git a/pkg/credentialprovider/azure/azure_acr_helper.go b/pkg/credentialprovider/azure/azure_acr_helper.go index 839ccd6947a..12a2ad3f3b6 100644 --- a/pkg/credentialprovider/azure/azure_acr_helper.go +++ b/pkg/credentialprovider/azure/azure_acr_helper.go @@ -91,22 +91,22 @@ func receiveChallengeFromLoginServer(serverAddress string) (*authDirective, erro var challenge *http.Response if challenge, err = client.Do(r); err != nil { - return nil, fmt.Errorf("Error reaching registry endpoint %s, error: %s", challengeURL.String(), err) + return nil, fmt.Errorf("error reaching registry endpoint %s, error: %s", challengeURL.String(), err) } defer challenge.Body.Close() if challenge.StatusCode != 401 { - return nil, fmt.Errorf("Registry did not issue a valid AAD challenge, status: %d", challenge.StatusCode) + return nil, fmt.Errorf("registry did not issue a valid AAD challenge, status: %d", challenge.StatusCode) } var authHeader []string var ok bool if authHeader, ok = challenge.Header["Www-Authenticate"]; !ok { - return nil, fmt.Errorf("Challenge response does not contain header 'Www-Authenticate'") + return nil, fmt.Errorf("challenge response does not contain header 'Www-Authenticate'") } if len(authHeader) != 1 { - return nil, fmt.Errorf("Registry did not issue a valid AAD challenge, authenticate header [%s]", + return nil, fmt.Errorf("registry did not issue a valid AAD challenge, authenticate header [%s]", strings.Join(authHeader, ", ")) } @@ -114,7 +114,7 @@ func receiveChallengeFromLoginServer(serverAddress string) (*authDirective, erro authType := strings.ToLower(authSections[0]) var authParams *map[string]string if authParams, err = parseAssignments(authSections[1]); err != nil { - return nil, fmt.Errorf("Unable to understand the contents of Www-Authenticate header %s", authSections[1]) + return nil, fmt.Errorf("unable to understand the contents of Www-Authenticate header %s", authSections[1]) } // verify headers diff --git a/pkg/credentialprovider/config_test.go b/pkg/credentialprovider/config_test.go index a0723d9f1e8..edbdaa1abeb 100644 --- a/pkg/credentialprovider/config_test.go +++ b/pkg/credentialprovider/config_test.go @@ -29,7 +29,6 @@ import ( func TestReadDockerConfigFile(t *testing.T) { configJsonFileName := "config.json" var fileInfo *os.File - preferredPaths := []string{} //test dockerconfig json inputDockerconfigJsonFile := "{ \"auths\": { \"http://foo.example.com\":{\"auth\":\"Zm9vOmJhcgo=\",\"email\":\"foo@example.com\"}}}" @@ -40,7 +39,6 @@ func TestReadDockerConfigFile(t *testing.T) { return } defer os.RemoveAll(preferredPath) - preferredPaths = append(preferredPaths, preferredPath) absDockerConfigFileLocation, err := filepath.Abs(filepath.Join(preferredPath, configJsonFileName)) if err != nil { t.Fatalf("While trying to canonicalize %s: %v", preferredPath, err) diff --git a/pkg/credentialprovider/gcp/metadata_test.go b/pkg/credentialprovider/gcp/metadata_test.go index 7e9922572ad..6b00dc54c39 100644 --- a/pkg/credentialprovider/gcp/metadata_test.go +++ b/pkg/credentialprovider/gcp/metadata_test.go @@ -265,7 +265,7 @@ func TestContainerRegistryBasics(t *testing.T) { } val := creds[0] - if "_token" != val.Username { + if val.Username != "_token" { t.Errorf("Unexpected username value, want: %s, got: %s", "_token", val.Username) } if token.AccessToken != val.Password {