golint fixes for daemon/ package

- some method names were changed to have a 'Locking' suffix, as the
 downcased versions already existed, and the existing functions simply
 had locks around the already downcased version.
 - deleting unused functions
 - package comment
 - magic numbers replaced by golang constants
 - comments all over

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
This commit is contained in:
Morgan Bauer
2015-07-30 14:01:53 -07:00
parent 04b0fb6314
commit abd72d4008
49 changed files with 637 additions and 468 deletions

View File

@@ -86,9 +86,9 @@ func TestGet(t *testing.T) {
graph.Set(c5.Name, c5.ID)
daemon := &Daemon{
containers: store,
idIndex: index,
containerGraph: graph,
containers: store,
idIndex: index,
containerGraphDB: graph,
}
if container, _ := daemon.Get("3cdbd1aa394fd68559fd1441d6eff2ab7c1e6363582c82febfaa8045df3bd8de"); container != c2 {
@@ -130,15 +130,15 @@ func TestLoadWithVolume(t *testing.T) {
}
defer os.RemoveAll(tmp)
containerId := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerId)
containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerID)
if err := os.MkdirAll(containerPath, 0755); err != nil {
t.Fatal(err)
}
hostVolumeId := stringid.GenerateNonCryptoID()
vfsPath := filepath.Join(tmp, "vfs", "dir", hostVolumeId)
volumePath := filepath.Join(tmp, "volumes", hostVolumeId)
hostVolumeID := stringid.GenerateNonCryptoID()
vfsPath := filepath.Join(tmp, "vfs", "dir", hostVolumeID)
volumePath := filepath.Join(tmp, "volumes", hostVolumeID)
if err := os.MkdirAll(vfsPath, 0755); err != nil {
t.Fatal(err)
@@ -187,7 +187,7 @@ func TestLoadWithVolume(t *testing.T) {
}
defer volumedrivers.Unregister(volume.DefaultDriverName)
c, err := daemon.load(containerId)
c, err := daemon.load(containerID)
if err != nil {
t.Fatal(err)
}
@@ -202,8 +202,8 @@ func TestLoadWithVolume(t *testing.T) {
}
m := c.MountPoints["/vol1"]
if m.Name != hostVolumeId {
t.Fatalf("Expected mount name to be %s, was %s\n", hostVolumeId, m.Name)
if m.Name != hostVolumeID {
t.Fatalf("Expected mount name to be %s, was %s\n", hostVolumeID, m.Name)
}
if m.Destination != "/vol1" {
@@ -235,8 +235,8 @@ func TestLoadWithBindMount(t *testing.T) {
}
defer os.RemoveAll(tmp)
containerId := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerId)
containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerID)
if err = os.MkdirAll(containerPath, 0755); err != nil {
t.Fatal(err)
}
@@ -275,7 +275,7 @@ func TestLoadWithBindMount(t *testing.T) {
}
defer volumedrivers.Unregister(volume.DefaultDriverName)
c, err := daemon.load(containerId)
c, err := daemon.load(containerID)
if err != nil {
t.Fatal(err)
}
@@ -314,14 +314,14 @@ func TestLoadWithVolume17RC(t *testing.T) {
}
defer os.RemoveAll(tmp)
containerId := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerId)
containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerID)
if err := os.MkdirAll(containerPath, 0755); err != nil {
t.Fatal(err)
}
hostVolumeId := "6a3c03fc4a4e588561a543cc3bdd50089e27bd11bbb0e551e19bf735e2514101"
volumePath := filepath.Join(tmp, "volumes", hostVolumeId)
hostVolumeID := "6a3c03fc4a4e588561a543cc3bdd50089e27bd11bbb0e551e19bf735e2514101"
volumePath := filepath.Join(tmp, "volumes", hostVolumeID)
if err := os.MkdirAll(volumePath, 0755); err != nil {
t.Fatal(err)
@@ -366,7 +366,7 @@ func TestLoadWithVolume17RC(t *testing.T) {
}
defer volumedrivers.Unregister(volume.DefaultDriverName)
c, err := daemon.load(containerId)
c, err := daemon.load(containerID)
if err != nil {
t.Fatal(err)
}
@@ -381,8 +381,8 @@ func TestLoadWithVolume17RC(t *testing.T) {
}
m := c.MountPoints["/vol1"]
if m.Name != hostVolumeId {
t.Fatalf("Expected mount name to be %s, was %s\n", hostVolumeId, m.Name)
if m.Name != hostVolumeID {
t.Fatalf("Expected mount name to be %s, was %s\n", hostVolumeID, m.Name)
}
if m.Destination != "/vol1" {
@@ -414,15 +414,15 @@ func TestRemoveLocalVolumesFollowingSymlinks(t *testing.T) {
}
defer os.RemoveAll(tmp)
containerId := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerId)
containerID := "d59df5276e7b219d510fe70565e0404bc06350e0d4b43fe961f22f339980170e"
containerPath := filepath.Join(tmp, containerID)
if err := os.MkdirAll(containerPath, 0755); err != nil {
t.Fatal(err)
}
hostVolumeId := stringid.GenerateNonCryptoID()
vfsPath := filepath.Join(tmp, "vfs", "dir", hostVolumeId)
volumePath := filepath.Join(tmp, "volumes", hostVolumeId)
hostVolumeID := stringid.GenerateNonCryptoID()
vfsPath := filepath.Join(tmp, "vfs", "dir", hostVolumeID)
volumePath := filepath.Join(tmp, "volumes", hostVolumeID)
if err := os.MkdirAll(vfsPath, 0755); err != nil {
t.Fatal(err)
@@ -471,7 +471,7 @@ func TestRemoveLocalVolumesFollowingSymlinks(t *testing.T) {
}
defer volumedrivers.Unregister(volume.DefaultDriverName)
c, err := daemon.load(containerId)
c, err := daemon.load(containerID)
if err != nil {
t.Fatal(err)
}