fix add code style

This commit is contained in:
demoManito 2022-09-10 23:22:40 +08:00
parent e1a5e8537a
commit bf9c829e34
4 changed files with 22 additions and 22 deletions

View File

@ -43,13 +43,13 @@ type awsElasticBlockStoreAttacher struct {
awsVolumes aws.Volumes
}
var _ volume.Attacher = &awsElasticBlockStoreAttacher{}
var _ volume.Attacher = (*awsElasticBlockStoreAttacher)(nil)
var _ volume.DeviceMounter = &awsElasticBlockStoreAttacher{}
var _ volume.DeviceMounter = (*awsElasticBlockStoreAttacher)(nil)
var _ volume.AttachableVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.AttachableVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
var _ volume.DeviceMountableVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.DeviceMountableVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
func (plugin *awsElasticBlockStorePlugin) NewAttacher() (volume.Attacher, error) {
awsCloud, err := getCloudProvider(plugin.host.GetCloudProvider())
@ -234,7 +234,7 @@ func (attacher *awsElasticBlockStoreAttacher) MountDevice(spec *volume.Spec, dev
return err
}
options := []string{}
var options []string
if readOnly {
options = append(options, "ro")
}
@ -255,9 +255,9 @@ type awsElasticBlockStoreDetacher struct {
awsVolumes aws.Volumes
}
var _ volume.Detacher = &awsElasticBlockStoreDetacher{}
var _ volume.Detacher = (*awsElasticBlockStoreDetacher)(nil)
var _ volume.DeviceUnmounter = &awsElasticBlockStoreDetacher{}
var _ volume.DeviceUnmounter = (*awsElasticBlockStoreDetacher)(nil)
func (plugin *awsElasticBlockStorePlugin) NewDetacher() (volume.Detacher, error) {
awsCloud, err := getCloudProvider(plugin.host.GetCloudProvider())

View File

@ -51,10 +51,10 @@ type awsElasticBlockStorePlugin struct {
host volume.VolumeHost
}
var _ volume.VolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.PersistentVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.DeletableVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.ProvisionableVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.VolumePlugin = (*awsElasticBlockStorePlugin)(nil)
var _ volume.PersistentVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
var _ volume.DeletableVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
var _ volume.ProvisionableVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
const (
awsElasticBlockStorePluginName = "kubernetes.io/aws-ebs"
@ -311,9 +311,9 @@ func (plugin *awsElasticBlockStorePlugin) NodeExpand(resizeOptions volume.NodeRe
return true, nil
}
var _ volume.NodeExpandableVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.ExpandableVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.VolumePluginWithAttachLimits = &awsElasticBlockStorePlugin{}
var _ volume.NodeExpandableVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
var _ volume.ExpandableVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
var _ volume.VolumePluginWithAttachLimits = (*awsElasticBlockStorePlugin)(nil)
// Abstract interface to PD operations.
type ebsManager interface {
@ -350,7 +350,7 @@ type awsElasticBlockStoreMounter struct {
mountOptions []string
}
var _ volume.Mounter = &awsElasticBlockStoreMounter{}
var _ volume.Mounter = (*awsElasticBlockStoreMounter)(nil)
func (b *awsElasticBlockStoreMounter) GetAttributes() volume.Attributes {
return volume.Attributes{
@ -448,7 +448,7 @@ type awsElasticBlockStoreUnmounter struct {
*awsElasticBlockStore
}
var _ volume.Unmounter = &awsElasticBlockStoreUnmounter{}
var _ volume.Unmounter = (*awsElasticBlockStoreUnmounter)(nil)
// Unmounts the bind mount, and detaches the disk only if the PD
// resource was the last reference to that disk on the kubelet.
@ -465,7 +465,7 @@ type awsElasticBlockStoreDeleter struct {
*awsElasticBlockStore
}
var _ volume.Deleter = &awsElasticBlockStoreDeleter{}
var _ volume.Deleter = (*awsElasticBlockStoreDeleter)(nil)
func (d *awsElasticBlockStoreDeleter) GetPath() string {
return getPath(d.podUID, d.volName, d.plugin.host)
@ -480,7 +480,7 @@ type awsElasticBlockStoreProvisioner struct {
options volume.VolumeOptions
}
var _ volume.Provisioner = &awsElasticBlockStoreProvisioner{}
var _ volume.Provisioner = (*awsElasticBlockStoreProvisioner)(nil)
func (c *awsElasticBlockStoreProvisioner) Provision(selectedNode *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (*v1.PersistentVolume, error) {
if !util.ContainsAllAccessModes(c.plugin.GetAccessModes(), c.options.PVC.Spec.AccessModes) {

View File

@ -37,7 +37,7 @@ import (
"k8s.io/legacy-cloud-providers/aws"
)
var _ volume.BlockVolumePlugin = &awsElasticBlockStorePlugin{}
var _ volume.BlockVolumePlugin = (*awsElasticBlockStorePlugin)(nil)
func (plugin *awsElasticBlockStorePlugin) ConstructBlockVolumeSpec(podUID types.UID, volumeName, mapPath string) (*volume.Spec, error) {
pluginDir := plugin.host.GetVolumeDevicePluginDir(awsElasticBlockStorePluginName)
@ -145,14 +145,14 @@ type awsElasticBlockStoreUnmapper struct {
*awsElasticBlockStore
}
var _ volume.BlockVolumeUnmapper = &awsElasticBlockStoreUnmapper{}
var _ volume.BlockVolumeUnmapper = (*awsElasticBlockStoreUnmapper)(nil)
type awsElasticBlockStoreMapper struct {
*awsElasticBlockStore
readOnly bool
}
var _ volume.BlockVolumeMapper = &awsElasticBlockStoreMapper{}
var _ volume.BlockVolumeMapper = (*awsElasticBlockStoreMapper)(nil)
// GetGlobalMapPath returns global map path and error
// path: plugins/kubernetes.io/{PluginName}/volumeDevices/volumeID

View File

@ -218,7 +218,7 @@ func verifyDevicePath(devicePaths []string) (string, error) {
// This is more interesting on GCE (where we are able to identify volumes under /dev/disk-by-id)
// Here it is mostly about applying the partition path
func getDiskByIDPaths(volumeID aws.KubernetesVolumeID, partition string, devicePath string) []string {
devicePaths := []string{}
var devicePaths []string
if devicePath != "" {
devicePaths = append(devicePaths, devicePath)
}