Browse code

Fix golint warnings for integration-cli

Signed-off-by: Ben Firshman <ben@firshman.co.uk>

Ben Firshman authored on 2015/07/22 21:59:24
Showing 17 changed files
... ...
@@ -15,6 +15,7 @@ packages=(
15 15
 	daemon/network
16 16
 	docker
17 17
 	dockerinit
18
+	integration-cli
18 19
 	pkg/chrootarchive
19 20
 	pkg/directory
20 21
 	pkg/fileutils
... ...
@@ -584,7 +584,7 @@ RUN echo 'right'
584 584
 }
585 585
 
586 586
 func (s *DockerSuite) TestBuildApiLowerDockerfile(c *check.C) {
587
-	git, err := fakeGIT("repo", map[string]string{
587
+	git, err := newFakeGit("repo", map[string]string{
588 588
 		"dockerfile": `FROM busybox
589 589
 RUN echo from dockerfile`,
590 590
 	}, false)
... ...
@@ -609,7 +609,7 @@ RUN echo from dockerfile`,
609 609
 }
610 610
 
611 611
 func (s *DockerSuite) TestBuildApiBuildGitWithF(c *check.C) {
612
-	git, err := fakeGIT("repo", map[string]string{
612
+	git, err := newFakeGit("repo", map[string]string{
613 613
 		"baz": `FROM busybox
614 614
 RUN echo from baz`,
615 615
 		"Dockerfile": `FROM busybox
... ...
@@ -638,7 +638,7 @@ RUN echo from Dockerfile`,
638 638
 
639 639
 func (s *DockerSuite) TestBuildApiDoubleDockerfile(c *check.C) {
640 640
 	testRequires(c, UnixCli) // dockerfile overwrites Dockerfile on Windows
641
-	git, err := fakeGIT("repo", map[string]string{
641
+	git, err := newFakeGit("repo", map[string]string{
642 642
 		"Dockerfile": `FROM busybox
643 643
 RUN echo from Dockerfile`,
644 644
 		"dockerfile": `FROM busybox
... ...
@@ -809,14 +809,14 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
809 809
 	c.Assert(status, check.Equals, http.StatusCreated)
810 810
 
811 811
 	type resp struct {
812
-		Id string
812
+		ID string
813 813
 	}
814 814
 	var img resp
815 815
 	if err := json.Unmarshal(b, &img); err != nil {
816 816
 		c.Fatal(err)
817 817
 	}
818 818
 
819
-	cmd, err := inspectField(img.Id, "Config.Cmd")
819
+	cmd, err := inspectField(img.ID, "Config.Cmd")
820 820
 	if err != nil {
821 821
 		c.Fatal(err)
822 822
 	}
... ...
@@ -824,7 +824,7 @@ func (s *DockerSuite) TestContainerApiCommit(c *check.C) {
824 824
 		c.Fatalf("got wrong Cmd from commit: %q", cmd)
825 825
 	}
826 826
 	// sanity check, make sure the image is what we think it is
827
-	dockerCmd(c, "run", img.Id, "ls", "/test")
827
+	dockerCmd(c, "run", img.ID, "ls", "/test")
828 828
 }
829 829
 
830 830
 func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
... ...
@@ -841,26 +841,26 @@ func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
841 841
 	c.Assert(status, check.Equals, http.StatusCreated)
842 842
 
843 843
 	type resp struct {
844
-		Id string
844
+		ID string
845 845
 	}
846 846
 	var img resp
847 847
 	if err := json.Unmarshal(b, &img); err != nil {
848 848
 		c.Fatal(err)
849 849
 	}
850 850
 
851
-	label1, err := inspectFieldMap(img.Id, "Config.Labels", "key1")
851
+	label1, err := inspectFieldMap(img.ID, "Config.Labels", "key1")
852 852
 	if err != nil {
853 853
 		c.Fatal(err)
854 854
 	}
855 855
 	c.Assert(label1, check.Equals, "value1")
856 856
 
857
-	label2, err := inspectFieldMap(img.Id, "Config.Labels", "key2")
857
+	label2, err := inspectFieldMap(img.ID, "Config.Labels", "key2")
858 858
 	if err != nil {
859 859
 		c.Fatal(err)
860 860
 	}
861 861
 	c.Assert(label2, check.Equals, "value2")
862 862
 
863
-	cmd, err := inspectField(img.Id, "Config.Cmd")
863
+	cmd, err := inspectField(img.ID, "Config.Cmd")
864 864
 	if err != nil {
865 865
 		c.Fatal(err)
866 866
 	}
... ...
@@ -869,7 +869,7 @@ func (s *DockerSuite) TestContainerApiCommitWithLabelInConfig(c *check.C) {
869 869
 	}
870 870
 
871 871
 	// sanity check, make sure the image is what we think it is
872
-	dockerCmd(c, "run", img.Id, "ls", "/test")
872
+	dockerCmd(c, "run", img.ID, "ls", "/test")
873 873
 }
874 874
 
875 875
 func (s *DockerSuite) TestContainerApiBadPort(c *check.C) {
... ...
@@ -909,14 +909,14 @@ func (s *DockerSuite) TestContainerApiCreate(c *check.C) {
909 909
 	c.Assert(status, check.Equals, http.StatusCreated)
910 910
 
911 911
 	type createResp struct {
912
-		Id string
912
+		ID string
913 913
 	}
914 914
 	var container createResp
915 915
 	if err := json.Unmarshal(b, &container); err != nil {
916 916
 		c.Fatal(err)
917 917
 	}
918 918
 
919
-	out, _ := dockerCmd(c, "start", "-a", container.Id)
919
+	out, _ := dockerCmd(c, "start", "-a", container.ID)
920 920
 	if strings.TrimSpace(out) != "/test" {
921 921
 		c.Fatalf("expected output `/test`, got %q", out)
922 922
 	}
... ...
@@ -1050,15 +1050,15 @@ func (s *DockerSuite) TestContainerApiCreateWithCpuSharesCpuset(c *check.C) {
1050 1050
 	c.Assert(err, check.IsNil)
1051 1051
 	c.Assert(status, check.Equals, http.StatusOK)
1052 1052
 
1053
-	var containerJson types.ContainerJSON
1053
+	var containerJSON types.ContainerJSON
1054 1054
 
1055
-	c.Assert(json.Unmarshal(body, &containerJson), check.IsNil)
1055
+	c.Assert(json.Unmarshal(body, &containerJSON), check.IsNil)
1056 1056
 
1057
-	out, err := inspectField(containerJson.Id, "HostConfig.CpuShares")
1057
+	out, err := inspectField(containerJSON.Id, "HostConfig.CpuShares")
1058 1058
 	c.Assert(err, check.IsNil)
1059 1059
 	c.Assert(out, check.Equals, "512")
1060 1060
 
1061
-	outCpuset, errCpuset := inspectField(containerJson.Id, "HostConfig.CpusetCpus")
1061
+	outCpuset, errCpuset := inspectField(containerJSON.Id, "HostConfig.CpusetCpus")
1062 1062
 	c.Assert(errCpuset, check.IsNil, check.Commentf("Output: %s", outCpuset))
1063 1063
 	c.Assert(outCpuset, check.Equals, "0,1")
1064 1064
 }
... ...
@@ -1154,14 +1154,14 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
1154 1154
 		c.Fatal(err)
1155 1155
 	}
1156 1156
 	type createResp struct {
1157
-		Id string
1157
+		ID string
1158 1158
 	}
1159 1159
 	var container createResp
1160 1160
 	if err := json.Unmarshal(b, &container); err != nil {
1161 1161
 		c.Fatal(err)
1162 1162
 	}
1163 1163
 
1164
-	out, err := inspectField(container.Id, "HostConfig.CpusetCpus")
1164
+	out, err := inspectField(container.ID, "HostConfig.CpusetCpus")
1165 1165
 	if err != nil {
1166 1166
 		c.Fatal(err, out)
1167 1167
 	}
... ...
@@ -1169,12 +1169,12 @@ func (s *DockerSuite) TestContainerApiPostCreateNull(c *check.C) {
1169 1169
 		c.Fatalf("expected empty string, got %q", out)
1170 1170
 	}
1171 1171
 
1172
-	outMemory, errMemory := inspectField(container.Id, "HostConfig.Memory")
1172
+	outMemory, errMemory := inspectField(container.ID, "HostConfig.Memory")
1173 1173
 	c.Assert(outMemory, check.Equals, "0")
1174 1174
 	if errMemory != nil {
1175 1175
 		c.Fatal(errMemory, outMemory)
1176 1176
 	}
1177
-	outMemorySwap, errMemorySwap := inspectField(container.Id, "HostConfig.MemorySwap")
1177
+	outMemorySwap, errMemorySwap := inspectField(container.ID, "HostConfig.MemorySwap")
1178 1178
 	c.Assert(outMemorySwap, check.Equals, "0")
1179 1179
 	if errMemorySwap != nil {
1180 1180
 		c.Fatal(errMemorySwap, outMemorySwap)
... ...
@@ -1890,7 +1890,7 @@ func (s *DockerSuite) TestBuildCancelationKillsSleep(c *check.C) {
1890 1890
 	}
1891 1891
 
1892 1892
 	// Get the exit status of `docker build`, check it exited because killed.
1893
-	if err := buildCmd.Wait(); err != nil && !IsKilled(err) {
1893
+	if err := buildCmd.Wait(); err != nil && !isKilled(err) {
1894 1894
 		c.Fatalf("wait failed during build run: %T %s", err, err)
1895 1895
 	}
1896 1896
 
... ...
@@ -4065,7 +4065,7 @@ func (s *DockerSuite) TestBuildAddTarXzGz(c *check.C) {
4065 4065
 
4066 4066
 func (s *DockerSuite) TestBuildFromGIT(c *check.C) {
4067 4067
 	name := "testbuildfromgit"
4068
-	git, err := fakeGIT("repo", map[string]string{
4068
+	git, err := newFakeGit("repo", map[string]string{
4069 4069
 		"Dockerfile": `FROM busybox
4070 4070
 					ADD first /first
4071 4071
 					RUN [ -f /first ]
... ...
@@ -4092,7 +4092,7 @@ func (s *DockerSuite) TestBuildFromGIT(c *check.C) {
4092 4092
 
4093 4093
 func (s *DockerSuite) TestBuildFromGITWithContext(c *check.C) {
4094 4094
 	name := "testbuildfromgit"
4095
-	git, err := fakeGIT("repo", map[string]string{
4095
+	git, err := newFakeGit("repo", map[string]string{
4096 4096
 		"docker/Dockerfile": `FROM busybox
4097 4097
 					ADD first /first
4098 4098
 					RUN [ -f /first ]
... ...
@@ -10,7 +10,7 @@ import (
10 10
 )
11 11
 
12 12
 func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
13
-	testRequires(c, CpuCfsQuota)
13
+	testRequires(c, cpuCfsQuota)
14 14
 	name := "testbuildresourceconstraints"
15 15
 
16 16
 	ctx, err := fakeContext(`
... ...
@@ -32,8 +32,8 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
32 32
 		MemorySwap int64
33 33
 		CpusetCpus string
34 34
 		CpusetMems string
35
-		CpuShares  int64
36
-		CpuQuota   int64
35
+		CPUShares  int64
36
+		CPUQuota   int64
37 37
 	}
38 38
 
39 39
 	cfg, err := inspectFieldJSON(cID, "HostConfig")
... ...
@@ -45,9 +45,9 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
45 45
 	if err := json.Unmarshal([]byte(cfg), &c1); err != nil {
46 46
 		c.Fatal(err, cfg)
47 47
 	}
48
-	if c1.Memory != 67108864 || c1.MemorySwap != -1 || c1.CpusetCpus != "0" || c1.CpusetMems != "0" || c1.CpuShares != 100 || c1.CpuQuota != 8000 {
49
-		c.Fatalf("resource constraints not set properly:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CpuShares: %d, CpuQuota: %d",
50
-			c1.Memory, c1.MemorySwap, c1.CpusetCpus, c1.CpusetMems, c1.CpuShares, c1.CpuQuota)
48
+	if c1.Memory != 67108864 || c1.MemorySwap != -1 || c1.CpusetCpus != "0" || c1.CpusetMems != "0" || c1.CPUShares != 100 || c1.CPUQuota != 8000 {
49
+		c.Fatalf("resource constraints not set properly:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CPUShares: %d, CPUQuota: %d",
50
+			c1.Memory, c1.MemorySwap, c1.CpusetCpus, c1.CpusetMems, c1.CPUShares, c1.CPUQuota)
51 51
 	}
52 52
 
53 53
 	// Make sure constraints aren't saved to image
... ...
@@ -61,9 +61,9 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
61 61
 	if err := json.Unmarshal([]byte(cfg), &c2); err != nil {
62 62
 		c.Fatal(err, cfg)
63 63
 	}
64
-	if c2.Memory == 67108864 || c2.MemorySwap == -1 || c2.CpusetCpus == "0" || c2.CpusetMems == "0" || c2.CpuShares == 100 || c2.CpuQuota == 8000 {
65
-		c.Fatalf("resource constraints leaked from build:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CpuShares: %d, CpuQuota: %d",
66
-			c2.Memory, c2.MemorySwap, c2.CpusetCpus, c2.CpusetMems, c2.CpuShares, c2.CpuQuota)
64
+	if c2.Memory == 67108864 || c2.MemorySwap == -1 || c2.CpusetCpus == "0" || c2.CpusetMems == "0" || c2.CPUShares == 100 || c2.CPUQuota == 8000 {
65
+		c.Fatalf("resource constraints leaked from build:\nMemory: %d, MemSwap: %d, CpusetCpus: %s, CpusetMems: %s, CPUShares: %d, CPUQuota: %d",
66
+			c2.Memory, c2.MemorySwap, c2.CpusetCpus, c2.CpusetMems, c2.CPUShares, c2.CPUQuota)
67 67
 	}
68 68
 
69 69
 }
... ...
@@ -13,37 +13,37 @@ import (
13 13
 	"github.com/go-check/check"
14 14
 )
15 15
 
16
-type FileType uint32
16
+type fileType uint32
17 17
 
18 18
 const (
19
-	Regular FileType = iota
20
-	Dir
21
-	Symlink
19
+	ftRegular fileType = iota
20
+	ftDir
21
+	ftSymlink
22 22
 )
23 23
 
24
-type FileData struct {
25
-	filetype FileType
24
+type fileData struct {
25
+	filetype fileType
26 26
 	path     string
27 27
 	contents string
28 28
 }
29 29
 
30
-func (fd FileData) creationCommand() string {
30
+func (fd fileData) creationCommand() string {
31 31
 	var command string
32 32
 
33 33
 	switch fd.filetype {
34
-	case Regular:
34
+	case ftRegular:
35 35
 		// Don't overwrite the file if it already exists!
36 36
 		command = fmt.Sprintf("if [ ! -f %s ]; then echo %q > %s; fi", fd.path, fd.contents, fd.path)
37
-	case Dir:
37
+	case ftDir:
38 38
 		command = fmt.Sprintf("mkdir -p %s", fd.path)
39
-	case Symlink:
39
+	case ftSymlink:
40 40
 		command = fmt.Sprintf("ln -fs %s %s", fd.contents, fd.path)
41 41
 	}
42 42
 
43 43
 	return command
44 44
 }
45 45
 
46
-func mkFilesCommand(fds []FileData) string {
46
+func mkFilesCommand(fds []fileData) string {
47 47
 	commands := make([]string, len(fds))
48 48
 
49 49
 	for i, fd := range fds {
... ...
@@ -53,29 +53,29 @@ func mkFilesCommand(fds []FileData) string {
53 53
 	return strings.Join(commands, " && ")
54 54
 }
55 55
 
56
-var defaultFileData = []FileData{
57
-	{Regular, "file1", "file1"},
58
-	{Regular, "file2", "file2"},
59
-	{Regular, "file3", "file3"},
60
-	{Regular, "file4", "file4"},
61
-	{Regular, "file5", "file5"},
62
-	{Regular, "file6", "file6"},
63
-	{Regular, "file7", "file7"},
64
-	{Dir, "dir1", ""},
65
-	{Regular, "dir1/file1-1", "file1-1"},
66
-	{Regular, "dir1/file1-2", "file1-2"},
67
-	{Dir, "dir2", ""},
68
-	{Regular, "dir2/file2-1", "file2-1"},
69
-	{Regular, "dir2/file2-2", "file2-2"},
70
-	{Dir, "dir3", ""},
71
-	{Regular, "dir3/file3-1", "file3-1"},
72
-	{Regular, "dir3/file3-2", "file3-2"},
73
-	{Dir, "dir4", ""},
74
-	{Regular, "dir4/file3-1", "file4-1"},
75
-	{Regular, "dir4/file3-2", "file4-2"},
76
-	{Dir, "dir5", ""},
77
-	{Symlink, "symlink1", "target1"},
78
-	{Symlink, "symlink2", "target2"},
56
+var defaultFileData = []fileData{
57
+	{ftRegular, "file1", "file1"},
58
+	{ftRegular, "file2", "file2"},
59
+	{ftRegular, "file3", "file3"},
60
+	{ftRegular, "file4", "file4"},
61
+	{ftRegular, "file5", "file5"},
62
+	{ftRegular, "file6", "file6"},
63
+	{ftRegular, "file7", "file7"},
64
+	{ftDir, "dir1", ""},
65
+	{ftRegular, "dir1/file1-1", "file1-1"},
66
+	{ftRegular, "dir1/file1-2", "file1-2"},
67
+	{ftDir, "dir2", ""},
68
+	{ftRegular, "dir2/file2-1", "file2-1"},
69
+	{ftRegular, "dir2/file2-2", "file2-2"},
70
+	{ftDir, "dir3", ""},
71
+	{ftRegular, "dir3/file3-1", "file3-1"},
72
+	{ftRegular, "dir3/file3-2", "file3-2"},
73
+	{ftDir, "dir4", ""},
74
+	{ftRegular, "dir4/file3-1", "file4-1"},
75
+	{ftRegular, "dir4/file3-2", "file4-2"},
76
+	{ftDir, "dir5", ""},
77
+	{ftSymlink, "symlink1", "target1"},
78
+	{ftSymlink, "symlink2", "target2"},
79 79
 }
80 80
 
81 81
 func defaultMkContentCommand() string {
... ...
@@ -86,15 +86,15 @@ func makeTestContentInDir(c *check.C, dir string) {
86 86
 	for _, fd := range defaultFileData {
87 87
 		path := filepath.Join(dir, filepath.FromSlash(fd.path))
88 88
 		switch fd.filetype {
89
-		case Regular:
89
+		case ftRegular:
90 90
 			if err := ioutil.WriteFile(path, []byte(fd.contents+"\n"), os.FileMode(0666)); err != nil {
91 91
 				c.Fatal(err)
92 92
 			}
93
-		case Dir:
93
+		case ftDir:
94 94
 			if err := os.Mkdir(path, os.FileMode(0777)); err != nil {
95 95
 				c.Fatal(err)
96 96
 			}
97
-		case Symlink:
97
+		case ftSymlink:
98 98
 			if err := os.Symlink(fd.contents, path); err != nil {
99 99
 				c.Fatal(err)
100 100
 			}
... ...
@@ -476,10 +476,10 @@ func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *check.C) {
476 476
 	defer d.Restart()
477 477
 
478 478
 	bridgeName := "external-bridge"
479
-	bridgeIp := "192.169.1.1/24"
480
-	_, bridgeIPNet, _ := net.ParseCIDR(bridgeIp)
479
+	bridgeIP := "192.169.1.1/24"
480
+	_, bridgeIPNet, _ := net.ParseCIDR(bridgeIP)
481 481
 
482
-	out, err := createInterface(c, "bridge", bridgeName, bridgeIp)
482
+	out, err := createInterface(c, "bridge", bridgeName, bridgeIP)
483 483
 	c.Assert(err, check.IsNil, check.Commentf(out))
484 484
 	defer deleteInterface(c, bridgeName)
485 485
 
... ...
@@ -498,11 +498,11 @@ func (s *DockerDaemonSuite) TestDaemonBridgeExternal(c *check.C) {
498 498
 	_, err = d.Cmd("run", "-d", "--name", "ExtContainer", "busybox", "top")
499 499
 	c.Assert(err, check.IsNil)
500 500
 
501
-	containerIp := d.findContainerIP("ExtContainer")
502
-	ip := net.ParseIP(containerIp)
501
+	containerIP := d.findContainerIP("ExtContainer")
502
+	ip := net.ParseIP(containerIP)
503 503
 	c.Assert(bridgeIPNet.Contains(ip), check.Equals, true,
504 504
 		check.Commentf("Container IP-Address must be in the same subnet range : %s",
505
-			containerIp))
505
+			containerIP))
506 506
 }
507 507
 
508 508
 func createInterface(c *check.C, ifType string, ifName string, ipNet string) (string, error) {
... ...
@@ -547,10 +547,10 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) {
547 547
 
548 548
 	d := s.d
549 549
 
550
-	bridgeIp := "192.169.1.1/24"
551
-	ip, bridgeIPNet, _ := net.ParseCIDR(bridgeIp)
550
+	bridgeIP := "192.169.1.1/24"
551
+	ip, bridgeIPNet, _ := net.ParseCIDR(bridgeIP)
552 552
 
553
-	err := d.StartWithBusybox("--bip", bridgeIp)
553
+	err := d.StartWithBusybox("--bip", bridgeIP)
554 554
 	c.Assert(err, check.IsNil)
555 555
 	defer d.Restart()
556 556
 
... ...
@@ -575,11 +575,11 @@ func (s *DockerDaemonSuite) TestDaemonBridgeIP(c *check.C) {
575 575
 	out, err = d.Cmd("run", "-d", "--name", "test", "busybox", "top")
576 576
 	c.Assert(err, check.IsNil)
577 577
 
578
-	containerIp := d.findContainerIP("test")
579
-	ip = net.ParseIP(containerIp)
578
+	containerIP := d.findContainerIP("test")
579
+	ip = net.ParseIP(containerIP)
580 580
 	c.Assert(bridgeIPNet.Contains(ip), check.Equals, true,
581 581
 		check.Commentf("Container IP-Address must be in the same subnet range : %s",
582
-			containerIp))
582
+			containerIP))
583 583
 	deleteInterface(c, defaultNetworkBridge)
584 584
 }
585 585
 
... ...
@@ -622,9 +622,9 @@ func (s *DockerDaemonSuite) TestDaemonBridgeFixedCidr(c *check.C) {
622 622
 	d := s.d
623 623
 
624 624
 	bridgeName := "external-bridge"
625
-	bridgeIp := "192.169.1.1/24"
625
+	bridgeIP := "192.169.1.1/24"
626 626
 
627
-	out, err := createInterface(c, "bridge", bridgeName, bridgeIp)
627
+	out, err := createInterface(c, "bridge", bridgeName, bridgeIP)
628 628
 	c.Assert(err, check.IsNil, check.Commentf(out))
629 629
 	defer deleteInterface(c, bridgeName)
630 630
 
... ...
@@ -649,18 +649,18 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Implicit(c *check.C) {
649 649
 
650 650
 	d := s.d
651 651
 
652
-	bridgeIp := "192.169.1.1"
653
-	bridgeIpNet := fmt.Sprintf("%s/24", bridgeIp)
652
+	bridgeIP := "192.169.1.1"
653
+	bridgeIPNet := fmt.Sprintf("%s/24", bridgeIP)
654 654
 
655
-	err := d.StartWithBusybox("--bip", bridgeIpNet)
655
+	err := d.StartWithBusybox("--bip", bridgeIPNet)
656 656
 	c.Assert(err, check.IsNil)
657 657
 	defer d.Restart()
658 658
 
659
-	expectedMessage := fmt.Sprintf("default via %s dev", bridgeIp)
659
+	expectedMessage := fmt.Sprintf("default via %s dev", bridgeIP)
660 660
 	out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
661 661
 	c.Assert(strings.Contains(out, expectedMessage), check.Equals, true,
662 662
 		check.Commentf("Implicit default gateway should be bridge IP %s, but default route was '%s'",
663
-			bridgeIp, strings.TrimSpace(out)))
663
+			bridgeIP, strings.TrimSpace(out)))
664 664
 	deleteInterface(c, defaultNetworkBridge)
665 665
 }
666 666
 
... ...
@@ -670,19 +670,19 @@ func (s *DockerDaemonSuite) TestDaemonDefaultGatewayIPv4Explicit(c *check.C) {
670 670
 
671 671
 	d := s.d
672 672
 
673
-	bridgeIp := "192.169.1.1"
674
-	bridgeIpNet := fmt.Sprintf("%s/24", bridgeIp)
675
-	gatewayIp := "192.169.1.254"
673
+	bridgeIP := "192.169.1.1"
674
+	bridgeIPNet := fmt.Sprintf("%s/24", bridgeIP)
675
+	gatewayIP := "192.169.1.254"
676 676
 
677
-	err := d.StartWithBusybox("--bip", bridgeIpNet, "--default-gateway", gatewayIp)
677
+	err := d.StartWithBusybox("--bip", bridgeIPNet, "--default-gateway", gatewayIP)
678 678
 	c.Assert(err, check.IsNil)
679 679
 	defer d.Restart()
680 680
 
681
-	expectedMessage := fmt.Sprintf("default via %s dev", gatewayIp)
681
+	expectedMessage := fmt.Sprintf("default via %s dev", gatewayIP)
682 682
 	out, err := d.Cmd("run", "busybox", "ip", "-4", "route", "list", "0/0")
683 683
 	c.Assert(strings.Contains(out, expectedMessage), check.Equals, true,
684 684
 		check.Commentf("Explicit default gateway should be %s, but default route was '%s'",
685
-			gatewayIp, strings.TrimSpace(out)))
685
+			gatewayIP, strings.TrimSpace(out)))
686 686
 	deleteInterface(c, defaultNetworkBridge)
687 687
 }
688 688
 
... ...
@@ -723,9 +723,9 @@ func (s *DockerDaemonSuite) TestDaemonICCPing(c *check.C) {
723 723
 	d := s.d
724 724
 
725 725
 	bridgeName := "external-bridge"
726
-	bridgeIp := "192.169.1.1/24"
726
+	bridgeIP := "192.169.1.1/24"
727 727
 
728
-	out, err := createInterface(c, "bridge", bridgeName, bridgeIp)
728
+	out, err := createInterface(c, "bridge", bridgeName, bridgeIP)
729 729
 	c.Assert(err, check.IsNil, check.Commentf(out))
730 730
 	defer deleteInterface(c, bridgeName)
731 731
 
... ...
@@ -763,9 +763,9 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
763 763
 	d := s.d
764 764
 
765 765
 	bridgeName := "external-bridge"
766
-	bridgeIp := "192.169.1.1/24"
766
+	bridgeIP := "192.169.1.1/24"
767 767
 
768
-	out, err := createInterface(c, "bridge", bridgeName, bridgeIp)
768
+	out, err := createInterface(c, "bridge", bridgeName, bridgeIP)
769 769
 	c.Assert(err, check.IsNil, check.Commentf(out))
770 770
 	defer deleteInterface(c, bridgeName)
771 771
 
... ...
@@ -792,9 +792,9 @@ func (s *DockerDaemonSuite) TestDaemonICCLinkExpose(c *check.C) {
792 792
 
793 793
 func (s *DockerDaemonSuite) TestDaemonLinksIpTablesRulesWhenLinkAndUnlink(c *check.C) {
794 794
 	bridgeName := "external-bridge"
795
-	bridgeIp := "192.169.1.1/24"
795
+	bridgeIP := "192.169.1.1/24"
796 796
 
797
-	out, err := createInterface(c, "bridge", bridgeName, bridgeIp)
797
+	out, err := createInterface(c, "bridge", bridgeName, bridgeIP)
798 798
 	c.Assert(err, check.IsNil, check.Commentf(out))
799 799
 	defer deleteInterface(c, bridgeName)
800 800
 
... ...
@@ -1210,16 +1210,16 @@ func (s *DockerDaemonSuite) TestDaemonRestartKillWait(c *check.C) {
1210 1210
 // TestHttpsInfo connects via two-way authenticated HTTPS to the info endpoint
1211 1211
 func (s *DockerDaemonSuite) TestHttpsInfo(c *check.C) {
1212 1212
 	const (
1213
-		testDaemonHttpsAddr = "localhost:4271"
1213
+		testDaemonHTTPSAddr = "localhost:4271"
1214 1214
 	)
1215 1215
 
1216 1216
 	if err := s.d.Start("--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/server-cert.pem",
1217
-		"--tlskey", "fixtures/https/server-key.pem", "-H", testDaemonHttpsAddr); err != nil {
1217
+		"--tlskey", "fixtures/https/server-key.pem", "-H", testDaemonHTTPSAddr); err != nil {
1218 1218
 		c.Fatalf("Could not start daemon with busybox: %v", err)
1219 1219
 	}
1220 1220
 
1221 1221
 	//force tcp protocol
1222
-	host := fmt.Sprintf("tcp://%s", testDaemonHttpsAddr)
1222
+	host := fmt.Sprintf("tcp://%s", testDaemonHTTPSAddr)
1223 1223
 	daemonArgs := []string{"--host", host, "--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/client-cert.pem", "--tlskey", "fixtures/https/client-key.pem"}
1224 1224
 	out, err := s.d.CmdWithArgs(daemonArgs, "info")
1225 1225
 	if err != nil {
... ...
@@ -1232,15 +1232,15 @@ func (s *DockerDaemonSuite) TestHttpsInfo(c *check.C) {
1232 1232
 func (s *DockerDaemonSuite) TestHttpsInfoRogueCert(c *check.C) {
1233 1233
 	const (
1234 1234
 		errBadCertificate   = "remote error: bad certificate"
1235
-		testDaemonHttpsAddr = "localhost:4271"
1235
+		testDaemonHTTPSAddr = "localhost:4271"
1236 1236
 	)
1237 1237
 	if err := s.d.Start("--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/server-cert.pem",
1238
-		"--tlskey", "fixtures/https/server-key.pem", "-H", testDaemonHttpsAddr); err != nil {
1238
+		"--tlskey", "fixtures/https/server-key.pem", "-H", testDaemonHTTPSAddr); err != nil {
1239 1239
 		c.Fatalf("Could not start daemon with busybox: %v", err)
1240 1240
 	}
1241 1241
 
1242 1242
 	//force tcp protocol
1243
-	host := fmt.Sprintf("tcp://%s", testDaemonHttpsAddr)
1243
+	host := fmt.Sprintf("tcp://%s", testDaemonHTTPSAddr)
1244 1244
 	daemonArgs := []string{"--host", host, "--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/client-rogue-cert.pem", "--tlskey", "fixtures/https/client-rogue-key.pem"}
1245 1245
 	out, err := s.d.CmdWithArgs(daemonArgs, "info")
1246 1246
 	if err == nil || !strings.Contains(out, errBadCertificate) {
... ...
@@ -1253,15 +1253,15 @@ func (s *DockerDaemonSuite) TestHttpsInfoRogueCert(c *check.C) {
1253 1253
 func (s *DockerDaemonSuite) TestHttpsInfoRogueServerCert(c *check.C) {
1254 1254
 	const (
1255 1255
 		errCaUnknown             = "x509: certificate signed by unknown authority"
1256
-		testDaemonRogueHttpsAddr = "localhost:4272"
1256
+		testDaemonRogueHTTPSAddr = "localhost:4272"
1257 1257
 	)
1258 1258
 	if err := s.d.Start("--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/server-rogue-cert.pem",
1259
-		"--tlskey", "fixtures/https/server-rogue-key.pem", "-H", testDaemonRogueHttpsAddr); err != nil {
1259
+		"--tlskey", "fixtures/https/server-rogue-key.pem", "-H", testDaemonRogueHTTPSAddr); err != nil {
1260 1260
 		c.Fatalf("Could not start daemon with busybox: %v", err)
1261 1261
 	}
1262 1262
 
1263 1263
 	//force tcp protocol
1264
-	host := fmt.Sprintf("tcp://%s", testDaemonRogueHttpsAddr)
1264
+	host := fmt.Sprintf("tcp://%s", testDaemonRogueHTTPSAddr)
1265 1265
 	daemonArgs := []string{"--host", host, "--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/client-rogue-cert.pem", "--tlskey", "fixtures/https/client-rogue-key.pem"}
1266 1266
 	out, err := s.d.CmdWithArgs(daemonArgs, "info")
1267 1267
 	if err == nil || !strings.Contains(out, errCaUnknown) {
... ...
@@ -16,9 +16,9 @@ import (
16 16
 // regression test for #12546
17 17
 func (s *DockerSuite) TestExecInteractiveStdinClose(c *check.C) {
18 18
 	out, _ := dockerCmd(c, "run", "-itd", "busybox", "/bin/cat")
19
-	contId := strings.TrimSpace(out)
19
+	contID := strings.TrimSpace(out)
20 20
 
21
-	cmd := exec.Command(dockerBinary, "exec", "-i", contId, "echo", "-n", "hello")
21
+	cmd := exec.Command(dockerBinary, "exec", "-i", contID, "echo", "-n", "hello")
22 22
 	p, err := pty.Start(cmd)
23 23
 	if err != nil {
24 24
 		c.Fatal(err)
... ...
@@ -139,17 +139,17 @@ func (s *DockerSuite) TestImagesFilterSpaceTrimCase(c *check.C) {
139 139
 func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
140 140
 	// create container 1
141 141
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "true")
142
-	containerId1 := strings.TrimSpace(out)
142
+	containerID1 := strings.TrimSpace(out)
143 143
 
144 144
 	// tag as foobox
145
-	out, _ = dockerCmd(c, "commit", containerId1, "foobox")
146
-	imageId := stringid.TruncateID(strings.TrimSpace(out))
145
+	out, _ = dockerCmd(c, "commit", containerID1, "foobox")
146
+	imageID := stringid.TruncateID(strings.TrimSpace(out))
147 147
 
148 148
 	// overwrite the tag, making the previous image dangling
149 149
 	dockerCmd(c, "tag", "-f", "busybox", "foobox")
150 150
 
151 151
 	out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=true")
152
-	if e, a := 1, strings.Count(out, imageId); e != a {
152
+	if e, a := 1, strings.Count(out, imageID); e != a {
153 153
 		c.Fatalf("expected 1 dangling image, got %d: %s", a, out)
154 154
 	}
155 155
 }
... ...
@@ -171,12 +171,12 @@ func (s *DockerSuite) TestInspectImageGraphDriver(c *check.C) {
171 171
 		return
172 172
 	}
173 173
 
174
-	deviceId, err := inspectField(imageTest, "GraphDriver.Data.DeviceId")
174
+	deviceID, err := inspectField(imageTest, "GraphDriver.Data.DeviceId")
175 175
 	c.Assert(err, check.IsNil)
176 176
 
177
-	_, err = strconv.Atoi(deviceId)
177
+	_, err = strconv.Atoi(deviceID)
178 178
 	if err != nil {
179
-		c.Fatalf("failed to inspect DeviceId of the image: %s, %v", deviceId, err)
179
+		c.Fatalf("failed to inspect DeviceId of the image: %s, %v", deviceID, err)
180 180
 	}
181 181
 
182 182
 	deviceSize, err := inspectField(imageTest, "GraphDriver.Data.DeviceSize")
... ...
@@ -203,12 +203,12 @@ func (s *DockerSuite) TestInspectContainerGraphDriver(c *check.C) {
203 203
 		return
204 204
 	}
205 205
 
206
-	deviceId, err := inspectField(out, "GraphDriver.Data.DeviceId")
206
+	deviceID, err := inspectField(out, "GraphDriver.Data.DeviceId")
207 207
 	c.Assert(err, check.IsNil)
208 208
 
209
-	_, err = strconv.Atoi(deviceId)
209
+	_, err = strconv.Atoi(deviceID)
210 210
 	if err != nil {
211
-		c.Fatalf("failed to inspect DeviceId of the image: %s, %v", deviceId, err)
211
+		c.Fatalf("failed to inspect DeviceId of the image: %s, %v", deviceID, err)
212 212
 	}
213 213
 
214 214
 	deviceSize, err := inspectField(out, "GraphDriver.Data.DeviceSize")
... ...
@@ -1825,7 +1825,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
1825 1825
 	dockerCmd(c, "run", "-v", "/foo", "-v", "/bar/", "--name", "dark_helmet", "run_volumes_clean_paths")
1826 1826
 
1827 1827
 	out, err := inspectMountSourceField("dark_helmet", "/foo/")
1828
-	if err != mountNotFound {
1828
+	if err != errMountNotFound {
1829 1829
 		c.Fatalf("Found unexpected volume entry for '/foo/' in volumes\n%q", out)
1830 1830
 	}
1831 1831
 
... ...
@@ -1836,7 +1836,7 @@ func (s *DockerSuite) TestRunVolumesCleanPaths(c *check.C) {
1836 1836
 	}
1837 1837
 
1838 1838
 	out, err = inspectMountSourceField("dark_helmet", "/bar/")
1839
-	if err != mountNotFound {
1839
+	if err != errMountNotFound {
1840 1840
 		c.Fatalf("Found unexpected volume entry for '/bar/' in volumes\n%q", out)
1841 1841
 	}
1842 1842
 
... ...
@@ -250,7 +250,7 @@ func (s *DockerSuite) TestRunAttachDetach(c *check.C) {
250 250
 
251 251
 // "test" should be printed
252 252
 func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
253
-	testRequires(c, CpuCfsQuota)
253
+	testRequires(c, cpuCfsQuota)
254 254
 
255 255
 	out, _, err := dockerCmdWithError(c, "run", "--cpu-quota", "8000", "--name", "test", "busybox", "echo", "test")
256 256
 	if err != nil {
... ...
@@ -270,7 +270,7 @@ func (s *DockerSuite) TestRunEchoStdoutWithCPUQuota(c *check.C) {
270 270
 }
271 271
 
272 272
 func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
273
-	testRequires(c, CpuCfsPeriod)
273
+	testRequires(c, cpuCfsPeriod)
274 274
 
275 275
 	if _, _, err := dockerCmdWithError(c, "run", "--cpu-period", "50000", "--name", "test", "busybox", "true"); err != nil {
276 276
 		c.Fatalf("failed to run container: %v", err)
... ...
@@ -284,7 +284,7 @@ func (s *DockerSuite) TestRunWithCpuPeriod(c *check.C) {
284 284
 }
285 285
 
286 286
 func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
287
-	testRequires(c, OomControl)
287
+	testRequires(c, oomControl)
288 288
 	errChan := make(chan error)
289 289
 	go func() {
290 290
 		defer close(errChan)
... ...
@@ -269,7 +269,7 @@ func (s *DockerSuite) TestSaveDirectoryPermissions(c *check.C) {
269 269
 				c.Fatalf("failed to open %s: %s", layerPath, err)
270 270
 			}
271 271
 
272
-			entries, err := ListTar(f)
272
+			entries, err := listTar(f)
273 273
 			for _, e := range entries {
274 274
 				if !strings.Contains(e, "dev/") {
275 275
 					entriesSansDev = append(entriesSansDev, e)
... ...
@@ -289,6 +289,8 @@ func (d *Daemon) Cmd(name string, arg ...string) (string, error) {
289 289
 	return string(b), err
290 290
 }
291 291
 
292
+// CmdWithArgs will execute a docker CLI command against a daemon with the
293
+// given additional arguments
292 294
 func (d *Daemon) CmdWithArgs(daemonArgs []string, name string, arg ...string) (string, error) {
293 295
 	args := append(daemonArgs, name)
294 296
 	args = append(args, arg...)
... ...
@@ -297,33 +299,34 @@ func (d *Daemon) CmdWithArgs(daemonArgs []string, name string, arg ...string) (s
297 297
 	return string(b), err
298 298
 }
299 299
 
300
+// LogfileName returns the path the the daemon's log file
300 301
 func (d *Daemon) LogfileName() string {
301 302
 	return d.logFile.Name()
302 303
 }
303 304
 
304 305
 func daemonHost() string {
305
-	daemonUrlStr := "unix://" + opts.DefaultUnixSocket
306
+	daemonURLStr := "unix://" + opts.DefaultUnixSocket
306 307
 	if daemonHostVar := os.Getenv("DOCKER_HOST"); daemonHostVar != "" {
307
-		daemonUrlStr = daemonHostVar
308
+		daemonURLStr = daemonHostVar
308 309
 	}
309
-	return daemonUrlStr
310
+	return daemonURLStr
310 311
 }
311 312
 
312 313
 func sockConn(timeout time.Duration) (net.Conn, error) {
313 314
 	daemon := daemonHost()
314
-	daemonUrl, err := url.Parse(daemon)
315
+	daemonURL, err := url.Parse(daemon)
315 316
 	if err != nil {
316 317
 		return nil, fmt.Errorf("could not parse url %q: %v", daemon, err)
317 318
 	}
318 319
 
319 320
 	var c net.Conn
320
-	switch daemonUrl.Scheme {
321
+	switch daemonURL.Scheme {
321 322
 	case "unix":
322
-		return net.DialTimeout(daemonUrl.Scheme, daemonUrl.Path, timeout)
323
+		return net.DialTimeout(daemonURL.Scheme, daemonURL.Path, timeout)
323 324
 	case "tcp":
324
-		return net.DialTimeout(daemonUrl.Scheme, daemonUrl.Host, timeout)
325
+		return net.DialTimeout(daemonURL.Scheme, daemonURL.Host, timeout)
325 326
 	default:
326
-		return c, fmt.Errorf("unknown scheme %v (%s)", daemonUrl.Scheme, daemon)
327
+		return c, fmt.Errorf("unknown scheme %v (%s)", daemonURL.Scheme, daemon)
327 328
 	}
328 329
 }
329 330
 
... ...
@@ -638,10 +641,12 @@ func getContainerCount() (int, error) {
638 638
 	return 0, fmt.Errorf("couldn't find the Container count in the output")
639 639
 }
640 640
 
641
+// FakeContext creates directories that can be used as a build context
641 642
 type FakeContext struct {
642 643
 	Dir string
643 644
 }
644 645
 
646
+// Add a file at a path, creating directories where necessary
645 647
 func (f *FakeContext) Add(file, content string) error {
646 648
 	return f.addFile(file, []byte(content))
647 649
 }
... ...
@@ -658,11 +663,13 @@ func (f *FakeContext) addFile(file string, content []byte) error {
658 658
 
659 659
 }
660 660
 
661
+// Delete a file at a path
661 662
 func (f *FakeContext) Delete(file string) error {
662 663
 	filepath := path.Join(f.Dir, file)
663 664
 	return os.RemoveAll(filepath)
664 665
 }
665 666
 
667
+// Close deletes the context
666 668
 func (f *FakeContext) Close() error {
667 669
 	return os.RemoveAll(f.Dir)
668 670
 }
... ...
@@ -898,7 +905,7 @@ func inspectMountPoint(name, destination string) (types.MountPoint, error) {
898 898
 	return inspectMountPointJSON(out, destination)
899 899
 }
900 900
 
901
-var mountNotFound = errors.New("mount point not found")
901
+var errMountNotFound = errors.New("mount point not found")
902 902
 
903 903
 func inspectMountPointJSON(j, destination string) (types.MountPoint, error) {
904 904
 	var mp []types.MountPoint
... ...
@@ -915,7 +922,7 @@ func inspectMountPointJSON(j, destination string) (types.MountPoint, error) {
915 915
 	}
916 916
 
917 917
 	if m == nil {
918
-		return types.MountPoint{}, mountNotFound
918
+		return types.MountPoint{}, errMountNotFound
919 919
 	}
920 920
 
921 921
 	return *m, nil
... ...
@@ -1027,7 +1034,7 @@ func buildImageFromPath(name, path string, useCache bool) (string, error) {
1027 1027
 	return getIDByName(name)
1028 1028
 }
1029 1029
 
1030
-type GitServer interface {
1030
+type gitServer interface {
1031 1031
 	URL() string
1032 1032
 	Close() error
1033 1033
 }
... ...
@@ -1045,18 +1052,18 @@ func (r *localGitServer) URL() string {
1045 1045
 	return r.Server.URL
1046 1046
 }
1047 1047
 
1048
-type FakeGIT struct {
1048
+type fakeGit struct {
1049 1049
 	root    string
1050
-	server  GitServer
1050
+	server  gitServer
1051 1051
 	RepoURL string
1052 1052
 }
1053 1053
 
1054
-func (g *FakeGIT) Close() {
1054
+func (g *fakeGit) Close() {
1055 1055
 	g.server.Close()
1056 1056
 	os.RemoveAll(g.root)
1057 1057
 }
1058 1058
 
1059
-func fakeGIT(name string, files map[string]string, enforceLocalServer bool) (*FakeGIT, error) {
1059
+func newFakeGit(name string, files map[string]string, enforceLocalServer bool) (*fakeGit, error) {
1060 1060
 	ctx, err := fakeContextWithFiles(files)
1061 1061
 	if err != nil {
1062 1062
 		return nil, err
... ...
@@ -1112,7 +1119,7 @@ func fakeGIT(name string, files map[string]string, enforceLocalServer bool) (*Fa
1112 1112
 		return nil, err
1113 1113
 	}
1114 1114
 
1115
-	var server GitServer
1115
+	var server gitServer
1116 1116
 	if !enforceLocalServer {
1117 1117
 		// use fakeStorage server, which might be local or remote (at test daemon)
1118 1118
 		server, err = fakeStorageWithContext(fakeContextFromDir(root))
... ...
@@ -1124,7 +1131,7 @@ func fakeGIT(name string, files map[string]string, enforceLocalServer bool) (*Fa
1124 1124
 		httpServer := httptest.NewServer(http.FileServer(http.Dir(root)))
1125 1125
 		server = &localGitServer{httpServer}
1126 1126
 	}
1127
-	return &FakeGIT{
1127
+	return &fakeGit{
1128 1128
 		root:    root,
1129 1129
 		server:  server,
1130 1130
 		RepoURL: fmt.Sprintf("%s/%s.git", server.URL(), name),
... ...
@@ -1162,8 +1169,8 @@ func readFile(src string, c *check.C) (content string) {
1162 1162
 	return string(data)
1163 1163
 }
1164 1164
 
1165
-func containerStorageFile(containerId, basename string) string {
1166
-	return filepath.Join("/var/lib/docker/containers", containerId, basename)
1165
+func containerStorageFile(containerID, basename string) string {
1166
+	return filepath.Join("/var/lib/docker/containers", containerID, basename)
1167 1167
 }
1168 1168
 
1169 1169
 // docker commands that use this function must be run with the '-d' switch.
... ...
@@ -1180,8 +1187,8 @@ func runCommandAndReadContainerFile(filename string, cmd *exec.Cmd) ([]byte, err
1180 1180
 	return readContainerFile(contID, filename)
1181 1181
 }
1182 1182
 
1183
-func readContainerFile(containerId, filename string) ([]byte, error) {
1184
-	f, err := os.Open(containerStorageFile(containerId, filename))
1183
+func readContainerFile(containerID, filename string) ([]byte, error) {
1184
+	f, err := os.Open(containerStorageFile(containerID, filename))
1185 1185
 	if err != nil {
1186 1186
 		return nil, err
1187 1187
 	}
... ...
@@ -1195,8 +1202,8 @@ func readContainerFile(containerId, filename string) ([]byte, error) {
1195 1195
 	return content, nil
1196 1196
 }
1197 1197
 
1198
-func readContainerFileWithExec(containerId, filename string) ([]byte, error) {
1199
-	out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "exec", containerId, "cat", filename))
1198
+func readContainerFileWithExec(containerID, filename string) ([]byte, error) {
1199
+	out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "exec", containerID, "cat", filename))
1200 1200
 	return []byte(out), err
1201 1201
 }
1202 1202
 
... ...
@@ -66,7 +66,7 @@ func (t *testRegistryV2) Ping() error {
66 66
 	return nil
67 67
 }
68 68
 
69
-func (r *testRegistryV2) Close() {
70
-	r.cmd.Process.Kill()
71
-	os.RemoveAll(r.dir)
69
+func (t *testRegistryV2) Close() {
70
+	t.cmd.Process.Kill()
71
+	os.RemoveAll(t.dir)
72 72
 }
... ...
@@ -13,10 +13,10 @@ import (
13 13
 	"github.com/go-check/check"
14 14
 )
15 15
 
16
-type TestCondition func() bool
16
+type testCondition func() bool
17 17
 
18
-type TestRequirement struct {
19
-	Condition   TestCondition
18
+type testRequirement struct {
19
+	Condition   testCondition
20 20
 	SkipMessage string
21 21
 }
22 22
 
... ...
@@ -24,19 +24,19 @@ type TestRequirement struct {
24 24
 var (
25 25
 	daemonExecDriver string
26 26
 
27
-	SameHostDaemon = TestRequirement{
27
+	SameHostDaemon = testRequirement{
28 28
 		func() bool { return isLocalDaemon },
29 29
 		"Test requires docker daemon to runs on the same machine as CLI",
30 30
 	}
31
-	UnixCli = TestRequirement{
31
+	UnixCli = testRequirement{
32 32
 		func() bool { return isUnixCli },
33 33
 		"Test requires posix utilities or functionality to run.",
34 34
 	}
35
-	ExecSupport = TestRequirement{
35
+	ExecSupport = testRequirement{
36 36
 		func() bool { return supportsExec },
37 37
 		"Test requires 'docker exec' capabilities on the tested daemon.",
38 38
 	}
39
-	Network = TestRequirement{
39
+	Network = testRequirement{
40 40
 		func() bool {
41 41
 			// Set a timeout on the GET at 15s
42 42
 			var timeout = time.Duration(15 * time.Second)
... ...
@@ -57,14 +57,14 @@ var (
57 57
 		},
58 58
 		"Test requires network availability, environment variable set to none to run in a non-network enabled mode.",
59 59
 	}
60
-	Apparmor = TestRequirement{
60
+	Apparmor = testRequirement{
61 61
 		func() bool {
62 62
 			buf, err := ioutil.ReadFile("/sys/module/apparmor/parameters/enabled")
63 63
 			return err == nil && len(buf) > 1 && buf[0] == 'Y'
64 64
 		},
65 65
 		"Test requires apparmor is enabled.",
66 66
 	}
67
-	RegistryHosting = TestRequirement{
67
+	RegistryHosting = testRequirement{
68 68
 		func() bool {
69 69
 			// for now registry binary is built only if we're running inside
70 70
 			// container through `make test`. Figure that out by testing if
... ...
@@ -74,7 +74,7 @@ var (
74 74
 		},
75 75
 		fmt.Sprintf("Test requires an environment that can host %s in the same host", v2binary),
76 76
 	}
77
-	NativeExecDriver = TestRequirement{
77
+	NativeExecDriver = testRequirement{
78 78
 		func() bool {
79 79
 			if daemonExecDriver == "" {
80 80
 				// get daemon info
... ...
@@ -98,7 +98,7 @@ var (
98 98
 		},
99 99
 		"Test requires the native (libcontainer) exec driver.",
100 100
 	}
101
-	NotOverlay = TestRequirement{
101
+	NotOverlay = testRequirement{
102 102
 		func() bool {
103 103
 			cmd := exec.Command("grep", "^overlay / overlay", "/proc/mounts")
104 104
 			if err := cmd.Run(); err != nil {
... ...
@@ -108,7 +108,7 @@ var (
108 108
 		},
109 109
 		"Test requires underlying root filesystem not be backed by overlay.",
110 110
 	}
111
-	IPv6 = TestRequirement{
111
+	IPv6 = testRequirement{
112 112
 		func() bool {
113 113
 			cmd := exec.Command("test", "-f", "/proc/net/if_inet6")
114 114
 
... ...
@@ -123,7 +123,7 @@ var (
123 123
 
124 124
 // testRequires checks if the environment satisfies the requirements
125 125
 // for the test to run or skips the tests.
126
-func testRequires(c *check.C, requirements ...TestRequirement) {
126
+func testRequires(c *check.C, requirements ...testRequirement) {
127 127
 	for _, r := range requirements {
128 128
 		if !r.Condition() {
129 129
 			c.Skip(r.SkipMessage)
... ...
@@ -10,33 +10,33 @@ import (
10 10
 )
11 11
 
12 12
 var (
13
-	CpuCfsPeriod = TestRequirement{
13
+	cpuCfsPeriod = testRequirement{
14 14
 		func() bool {
15
-			cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
15
+			cgroupCPUMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
16 16
 			if err != nil {
17 17
 				return false
18 18
 			}
19
-			if _, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_period_us")); err != nil {
19
+			if _, err := ioutil.ReadFile(path.Join(cgroupCPUMountpoint, "cpu.cfs_period_us")); err != nil {
20 20
 				return false
21 21
 			}
22 22
 			return true
23 23
 		},
24 24
 		"Test requires an environment that supports cgroup cfs period.",
25 25
 	}
26
-	CpuCfsQuota = TestRequirement{
26
+	cpuCfsQuota = testRequirement{
27 27
 		func() bool {
28
-			cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
28
+			cgroupCPUMountpoint, err := cgroups.FindCgroupMountpoint("cpu")
29 29
 			if err != nil {
30 30
 				return false
31 31
 			}
32
-			if _, err := ioutil.ReadFile(path.Join(cgroupCpuMountpoint, "cpu.cfs_quota_us")); err != nil {
32
+			if _, err := ioutil.ReadFile(path.Join(cgroupCPUMountpoint, "cpu.cfs_quota_us")); err != nil {
33 33
 				return false
34 34
 			}
35 35
 			return true
36 36
 		},
37 37
 		"Test requires an environment that supports cgroup cfs quota.",
38 38
 	}
39
-	OomControl = TestRequirement{
39
+	oomControl = testRequirement{
40 40
 		func() bool {
41 41
 			cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory")
42 42
 			if err != nil {
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"errors"
8 8
 	"fmt"
9 9
 	"io"
10
-	"net/http/httptest"
11 10
 	"os"
12 11
 	"os/exec"
13 12
 	"path"
... ...
@@ -41,7 +40,7 @@ func processExitCode(err error) (exitCode int) {
41 41
 	return
42 42
 }
43 43
 
44
-func IsKilled(err error) bool {
44
+func isKilled(err error) bool {
45 45
 	if exitErr, ok := err.(*exec.ExitError); ok {
46 46
 		status, ok := exitErr.Sys().(syscall.WaitStatus)
47 47
 		if !ok {
... ...
@@ -114,13 +113,13 @@ func runCommandWithOutputForDuration(cmd *exec.Cmd, duration time.Duration) (out
114 114
 	return
115 115
 }
116 116
 
117
-var ErrCmdTimeout = fmt.Errorf("command timed out")
117
+var errCmdTimeout = fmt.Errorf("command timed out")
118 118
 
119 119
 func runCommandWithOutputAndTimeout(cmd *exec.Cmd, timeout time.Duration) (output string, exitCode int, err error) {
120 120
 	var timedOut bool
121 121
 	output, exitCode, timedOut, err = runCommandWithOutputForDuration(cmd, timeout)
122 122
 	if timedOut {
123
-		err = ErrCmdTimeout
123
+		err = errCmdTimeout
124 124
 	}
125 125
 	return
126 126
 }
... ...
@@ -253,7 +252,7 @@ func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error {
253 253
 	return nil
254 254
 }
255 255
 
256
-func ListTar(f io.Reader) ([]string, error) {
256
+func listTar(f io.Reader) ([]string, error) {
257 257
 	tr := tar.NewReader(f)
258 258
 	var entries []string
259 259
 
... ...
@@ -270,10 +269,6 @@ func ListTar(f io.Reader) ([]string, error) {
270 270
 	}
271 271
 }
272 272
 
273
-type FileServer struct {
274
-	*httptest.Server
275
-}
276
-
277 273
 // randomUnixTmpDirPath provides a temporary unix path with rand string appended.
278 274
 // does not create or checks if it exists.
279 275
 func randomUnixTmpDirPath(s string) string {