chore(go-lint): fix golint warning (#133)

Fixes several go lint cases reported by go report. 

Signed-off-by: wiwen <shenggxhz@gmail.com>
This commit is contained in:
wiwen 2020-06-09 17:17:23 +08:00 committed by GitHub
parent 639ead416e
commit f5ae3ff476
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 78 additions and 51 deletions

View file

@ -235,7 +235,7 @@ func MountDataset(vol *apis.ZFSVolume, mount *apis.MountInfo) error {
return nil
}
// MountVolume mounts the disk to the specified path
// MountFilesystem mounts the disk to the specified path
func MountFilesystem(vol *apis.ZFSVolume, mount *apis.MountInfo) error {
switch vol.Spec.VolumeType {
case VOLTYPE_DATASET:
@ -245,6 +245,7 @@ func MountFilesystem(vol *apis.ZFSVolume, mount *apis.MountInfo) error {
}
}
// MountBlock mounts the block disk to the specified path
func MountBlock(vol *apis.ZFSVolume, mountinfo *apis.MountInfo) error {
target := mountinfo.MountPath
devicePath := ZFS_DEVPATH + vol.Spec.PoolName + "/" + vol.Name

View file

@ -27,11 +27,11 @@ import (
)
const (
// OpenEBSNamespace is the environment variable to get openebs namespace
// OpenEBSNamespaceKey is the environment variable to get openebs namespace
//
// This environment variable is set via kubernetes downward API
OpenEBSNamespaceKey string = "OPENEBS_NAMESPACE"
// This environment variable is set via env
// GoogleAnalyticsKey This environment variable is set via env
GoogleAnalyticsKey string = "OPENEBS_IO_ENABLE_ANALYTICS"
// ZFSFinalizer for the ZfsVolume CR
ZFSFinalizer string = "zfs.openebs.io/finalizer"
@ -56,7 +56,7 @@ var (
// NodeID is the NodeID of the node on which the pod is present
NodeID string
// should send google analytics or not
// GoogleAnalyticsEnabled should send google analytics or not
GoogleAnalyticsEnabled string
)

View file

@ -24,7 +24,7 @@ import (
"strings"
)
func xfs_temp_mount(volume string) error {
func xfsTempMount(volume string) error {
device := ZFS_DEVPATH + volume
pvol := strings.Split(volume, "/")
@ -69,11 +69,11 @@ func xfs_temp_mount(volume string) error {
* There might be something there in the xfs log, we have to clear them
* so that filesystem is clean and we can generate the UUID for it.
*/
func xfs_generate_uuid(volume string) error {
func xfsGenerateUuid(volume string) error {
device := ZFS_DEVPATH + volume
// temporary mount the volume with nouuid to replay the logs
err := xfs_temp_mount(volume)
err := xfsTempMount(volume)
if err != nil {
return err
}

View file

@ -49,6 +49,7 @@ const (
VOLTYPE_ZVOL = "ZVOL"
)
// PropertyChanged return whether volume property is changed
func PropertyChanged(oldVol *apis.ZFSVolume, newVol *apis.ZFSVolume) bool {
if oldVol.Spec.VolumeType == VOLTYPE_DATASET &&
newVol.Spec.VolumeType == VOLTYPE_DATASET &&
@ -363,7 +364,7 @@ func CreateClone(vol *apis.ZFSVolume) error {
}
if vol.Spec.FsType == "xfs" {
return xfs_generate_uuid(volume)
return xfsGenerateUuid(volume)
}
return nil
}
@ -597,6 +598,7 @@ func GetVolumeDevPath(vol *apis.ZFSVolume) (string, error) {
return dev, nil
}
// ResizeZFSVolume resize volume
func ResizeZFSVolume(vol *apis.ZFSVolume, mountpath string) error {
volume := vol.Spec.PoolName + "/" + vol.Name