Merge pull request #93136 from donggangcj/fix-static-check-error

fix(staticcheck): fix static error of package `/pkg/volume/gcepd`
This commit is contained in:
Kubernetes Prow Robot 2020-08-28 06:35:21 -07:00 committed by GitHub
commit 7abc47d315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View File

@ -3,7 +3,6 @@ pkg/controller/podautoscaler
pkg/controller/replicaset
pkg/controller/resourcequota
pkg/volume/azure_dd
pkg/volume/gcepd
pkg/volume/testing
test/e2e/autoscaling
test/integration/examples

View File

@ -220,7 +220,7 @@ func getDiskID(pdName string, exec utilexec.Interface) (string, error) {
}
}
return "", fmt.Errorf("Could not found disk number for disk %q", pdName)
return "", fmt.Errorf("could not found disk number for disk %q", pdName)
}
func (attacher *gcePersistentDiskAttacher) WaitForAttach(spec *volume.Spec, devicePath string, _ *v1.Pod, timeout time.Duration) (string, error) {

View File

@ -128,11 +128,11 @@ func (plugin *gcePersistentDiskPlugin) GetVolumeLimits() (map[string]int64, erro
// default values from here will mean, no one can
// override them.
if cloud == nil {
return nil, fmt.Errorf("No cloudprovider present")
return nil, fmt.Errorf("no cloudprovider present")
}
if cloud.ProviderName() != gcecloud.ProviderName {
return nil, fmt.Errorf("Expected gce cloud got %s", cloud.ProviderName())
return nil, fmt.Errorf("expected gce cloud got %s", cloud.ProviderName())
}
instances, ok := cloud.Instances()
@ -175,7 +175,7 @@ func getVolumeSource(
return spec.PersistentVolume.Spec.GCEPersistentDisk, spec.ReadOnly, nil
}
return nil, false, fmt.Errorf("Spec does not reference a GCE volume type")
return nil, false, fmt.Errorf("spec does not reference a GCE volume type")
}
func (plugin *gcePersistentDiskPlugin) newMounterInternal(spec *volume.Spec, podUID types.UID, manager pdManager, mounter mount.Interface) (volume.Mounter, error) {

View File

@ -222,10 +222,11 @@ func TestPlugin(t *testing.T) {
r, _ = getNodeSelectorRequirementWithKey(v1.LabelZoneFailureDomain, term)
if r == nil {
t.Errorf("NodeSelectorRequirement %s-in-%v not found in volume NodeAffinity", v1.LabelZoneFailureDomain, zones)
}
sort.Strings(r.Values)
if !reflect.DeepEqual(r.Values, zones.List()) {
t.Errorf("ZoneFailureDomain elements %v does not match zone labels %v", r.Values, zones)
} else {
sort.Strings(r.Values)
if !reflect.DeepEqual(r.Values, zones.List()) {
t.Errorf("ZoneFailureDomain elements %v does not match zone labels %v", r.Values, zones)
}
}
// Test Deleter

View File

@ -211,7 +211,7 @@ func verifyDevicePath(devicePaths []string, sdBeforeSet sets.String, diskName st
for _, path := range devicePaths {
if pathExists, err := mount.PathExists(path); err != nil {
return "", fmt.Errorf("Error checking if path exists: %v", err)
return "", fmt.Errorf("error checking if path exists: %v", err)
} else if pathExists {
// validate that the path actually resolves to the correct disk
serial, err := getScsiSerial(path, diskName)
@ -301,7 +301,7 @@ func getCloudProvider(cloudProvider cloudprovider.Interface) (*gcecloud.Cloud, e
return gceCloudProvider, nil
}
return nil, fmt.Errorf("Failed to get GCE GCECloudProvider with error %v", err)
return nil, fmt.Errorf("failed to get GCE GCECloudProvider with error %v", err)
}
// Triggers the application of udev rules by calling "udevadm trigger