Correcting all go vet errors

This commit is contained in:
Kris Rousey
2015-08-07 18:52:23 -07:00
parent 9fdd793555
commit 565189f5b8
118 changed files with 285 additions and 298 deletions

View File

@@ -188,7 +188,7 @@ func doTestPlugin(t *testing.T, config pluginTestConfig) {
pod,
&mounter,
&mountDetector,
volume.VolumeOptions{config.rootContext},
volume.VolumeOptions{RootContext: config.rootContext},
fakeChconRnr)
if err != nil {
t.Errorf("Failed to make a new Builder: %v", err)
@@ -288,7 +288,7 @@ func TestPluginBackCompat(t *testing.T) {
Name: "vol1",
}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
builder, err := plug.NewBuilder(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{""}, nil)
builder, err := plug.NewBuilder(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{RootContext: ""}, nil)
if err != nil {
t.Errorf("Failed to make a new Builder: %v", err)
}

View File

@@ -120,7 +120,7 @@ func TestPlugin(t *testing.T) {
},
}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
builder, err := plug.NewBuilder(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{""}, mount.New())
builder, err := plug.NewBuilder(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{RootContext: ""}, mount.New())
if err != nil {
t.Errorf("Failed to make a new Builder: %v", err)
}

View File

@@ -102,7 +102,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Failed to make a new Builder: %v", err)
}
if builder == nil {
t.Errorf("Got a nil Builder: %v")
t.Error("Got a nil Builder")
}
path := builder.GetPath()
if path != "/tmp/fake/pods/poduid/volumes/kubernetes.io~glusterfs/vol1" {
@@ -123,7 +123,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Failed to make a new Cleaner: %v", err)
}
if cleaner == nil {
t.Errorf("Got a nil Cleaner: %v")
t.Error("Got a nil Cleaner")
}
if err := cleaner.TearDown(); err != nil {
t.Errorf("Expected success, got: %v", err)
@@ -138,7 +138,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
func TestPluginVolume(t *testing.T) {
vol := &api.Volume{
Name: "vol1",
VolumeSource: api.VolumeSource{Glusterfs: &api.GlusterfsVolumeSource{"ep", "vol", false}},
VolumeSource: api.VolumeSource{Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false}},
}
doTestPlugin(t, volume.NewSpecFromVolume(vol))
}
@@ -150,7 +150,7 @@ func TestPluginPersistentVolume(t *testing.T) {
},
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{"ep", "vol", false},
Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false},
},
},
}
@@ -165,7 +165,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
},
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
Glusterfs: &api.GlusterfsVolumeSource{"ep", "vol", false},
Glusterfs: &api.GlusterfsVolumeSource{EndpointsName: "ep", Path: "vol", ReadOnly: false},
},
ClaimRef: &api.ObjectReference{
Name: "claimA",

View File

@@ -180,7 +180,7 @@ func (r *hostPathRecycler) Recycle() error {
{
Name: "vol",
VolumeSource: api.VolumeSource{
HostPath: &api.HostPathVolumeSource{r.path},
HostPath: &api.HostPathVolumeSource{Path: r.path},
},
},
},

View File

@@ -72,7 +72,7 @@ func TestRecycler(t *testing.T) {
}
recycler, err := plug.NewRecycler(spec)
if err != nil {
t.Error("Failed to make a new Recyler: %v", err)
t.Errorf("Failed to make a new Recyler: %v", err)
}
if recycler.GetPath() != spec.PersistentVolumeSource.HostPath.Path {
t.Errorf("Expected %s but got %s", spec.PersistentVolumeSource.HostPath.Path, recycler.GetPath())
@@ -112,7 +112,7 @@ func TestPlugin(t *testing.T) {
}
spec := &api.Volume{
Name: "vol1",
VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{"/vol1"}},
VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/vol1"}},
}
pod := &api.Pod{ObjectMeta: api.ObjectMeta{UID: types.UID("poduid")}}
builder, err := plug.NewBuilder(volume.NewSpecFromVolume(spec), pod, volume.VolumeOptions{}, nil)
@@ -152,7 +152,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
},
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{"foo"},
HostPath: &api.HostPathVolumeSource{Path: "foo"},
},
ClaimRef: &api.ObjectReference{
Name: "claimA",

View File

@@ -113,7 +113,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Failed to make a new Builder: %v", err)
}
if builder == nil {
t.Errorf("Got a nil Builder: %v")
t.Error("Got a nil Builder")
}
path := builder.GetPath()
@@ -148,7 +148,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Failed to make a new Cleaner: %v", err)
}
if cleaner == nil {
t.Errorf("Got a nil Cleaner: %v")
t.Error("Got a nil Cleaner")
}
if err := cleaner.TearDown(); err != nil {

View File

@@ -73,7 +73,7 @@ func TestRecycler(t *testing.T) {
}
recycler, err := plug.NewRecycler(spec)
if err != nil {
t.Error("Failed to make a new Recyler: %v", err)
t.Errorf("Failed to make a new Recyler: %v", err)
}
if recycler.GetPath() != spec.PersistentVolumeSource.NFS.Path {
t.Errorf("Expected %s but got %s", spec.PersistentVolumeSource.NFS.Path, recycler.GetPath())
@@ -184,7 +184,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
func TestPluginVolume(t *testing.T) {
vol := &api.Volume{
Name: "vol1",
VolumeSource: api.VolumeSource{NFS: &api.NFSVolumeSource{"localhost", "/tmp", false}},
VolumeSource: api.VolumeSource{NFS: &api.NFSVolumeSource{Server: "localhost", Path: "/tmp", ReadOnly: false}},
}
doTestPlugin(t, volume.NewSpecFromVolume(vol))
}
@@ -196,7 +196,7 @@ func TestPluginPersistentVolume(t *testing.T) {
},
Spec: api.PersistentVolumeSpec{
PersistentVolumeSource: api.PersistentVolumeSource{
NFS: &api.NFSVolumeSource{"localhost", "/tmp", false},
NFS: &api.NFSVolumeSource{Server: "localhost", Path: "/tmp", ReadOnly: false},
},
},
}

View File

@@ -251,7 +251,7 @@ func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVo
if persistentVolumePlugin, ok := volumePlugin.(PersistentVolumePlugin); ok {
return persistentVolumePlugin, nil
}
return nil, fmt.Errorf("no persistent volume plugin matched: %+v")
return nil, fmt.Errorf("no persistent volume plugin matched")
}
// FindRecyclablePluginByName fetches a persistent volume plugin by name. If no plugin

View File

@@ -80,7 +80,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Failed to make a new Builder: %v", err)
}
if builder == nil {
t.Errorf("Got a nil Builder: %v")
t.Error("Got a nil Builder")
}
path := builder.GetPath()
@@ -111,7 +111,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
t.Errorf("Failed to make a new Cleaner: %v", err)
}
if cleaner == nil {
t.Errorf("Got a nil Cleaner: %v")
t.Error("Got a nil Cleaner")
}
if err := cleaner.TearDown(); err != nil {