cephfs: address golangci-lint issues

address golangci-lint issues in cephfs
related code.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2024-04-04 10:50:20 +02:00
committed by mergify[bot]
parent 6961b103b8
commit a362ef6bd4
11 changed files with 40 additions and 45 deletions

View File

@ -54,11 +54,11 @@ func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeReq
return err
}
if req.VolumeContentSource != nil {
volumeSource := req.VolumeContentSource
switch volumeSource.Type.(type) {
if req.GetVolumeContentSource() != nil {
volumeSource := req.GetVolumeContentSource()
switch volumeSource.GetType().(type) {
case *csi.VolumeContentSource_Snapshot:
snapshot := req.VolumeContentSource.GetSnapshot()
snapshot := req.GetVolumeContentSource().GetSnapshot()
// CSI spec requires returning NOT_FOUND when the volumeSource is missing/incorrect.
if snapshot == nil {
return status.Error(codes.NotFound, "volume Snapshot cannot be empty")
@ -68,7 +68,7 @@ func (cs *ControllerServer) validateCreateVolumeRequest(req *csi.CreateVolumeReq
}
case *csi.VolumeContentSource_Volume:
// CSI spec requires returning NOT_FOUND when the volumeSource is missing/incorrect.
vol := req.VolumeContentSource.GetVolume()
vol := req.GetVolumeContentSource().GetVolume()
if vol == nil {
return status.Error(codes.NotFound, "volume cannot be empty")
}