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

@ -24,6 +24,10 @@ import (
"github.com/Sirupsen/logrus"
"github.com/container-storage-interface/spec/lib/go/csi"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"github.com/openebs/zfs-localpv/pkg/builder/snapbuilder"
"github.com/openebs/zfs-localpv/pkg/builder/volbuilder"
errors "github.com/openebs/zfs-localpv/pkg/common/errors"
@ -31,9 +35,6 @@ import (
csipayload "github.com/openebs/zfs-localpv/pkg/response"
analytics "github.com/openebs/zfs-localpv/pkg/usage"
zfs "github.com/openebs/zfs-localpv/pkg/zfs"
"golang.org/x/net/context"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// controller is the server implementation
@ -74,6 +75,7 @@ func sendEventOrIgnore(pvcName, pvName, capacity, stgType, method string) {
}
}
// CreateZFSVolume create new zfs volume from csi volume request
func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
volName := req.GetName()
size := req.GetCapacityRange().RequiredBytes
@ -137,6 +139,7 @@ func CreateZFSVolume(req *csi.CreateVolumeRequest) (string, error) {
return selected, nil
}
// CreateZFSClone create a clone of zfs volume
func CreateZFSClone(req *csi.CreateVolumeRequest, snapshot string) (string, error) {
volName := req.GetName()
@ -260,6 +263,14 @@ func (cs *controller) DeleteVolume(
goto deleteResponse
}
if err != nil {
return nil, errors.Wrapf(
err,
"failed to get volume for {%s}",
volumeID,
)
}
// Delete the corresponding ZV CR
err = zfs.DeleteVolume(volumeID)
if err != nil {