Fix local storage code to follow go style

pull/6/head
zhangxiaoyu-zidif 2017-08-31 22:09:41 +08:00
parent e794dce445
commit 90cb1c16eb
1 changed files with 4 additions and 5 deletions

View File

@ -18,9 +18,10 @@ package local
import (
"fmt"
"github.com/golang/glog"
"os"
"github.com/golang/glog"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
@ -204,8 +205,7 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
defer m.plugin.volumeLocks.UnlockKey(m.globalPath)
if m.globalPath == "" {
err := fmt.Errorf("LocalVolume volume %q path is empty", m.volName)
return err
return fmt.Errorf("LocalVolume volume %q path is empty", m.volName)
}
err := validation.ValidatePathNoBacksteps(m.globalPath)
@ -234,8 +234,7 @@ func (m *localVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
fsGroupNew := int64(*fsGroup)
fsGroupSame, fsGroupOld, err := volume.IsSameFSGroup(m.globalPath, fsGroupNew)
if err != nil {
err = fmt.Errorf("failed to check fsGroup for %s (%v)", m.globalPath, err)
return err
return fmt.Errorf("failed to check fsGroup for %s (%v)", m.globalPath, err)
}
if !fsGroupSame {
m.plugin.recorder.Eventf(m.pod, v1.EventTypeWarning, events.WarnAlreadyMountedVolume, "The requested fsGroup is %d, but the volume %s has GID %d. The volume may not be shareable.", fsGroupNew, m.volName, fsGroupOld)