Browse code

Fix go vet warnings

Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>

Alexandr Morozov authored on 2014/08/13 16:37:30
Showing 8 changed files
... ...
@@ -64,7 +64,12 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
64 64
 	}
65 65
 	c.Terminal = term
66 66
 
67
-	c.Mounts = append(c.Mounts, execdriver.Mount{d.initPath, c.InitPath, false, true})
67
+	c.Mounts = append(c.Mounts, execdriver.Mount{
68
+		Source:      d.initPath,
69
+		Destination: c.InitPath,
70
+		Writable:    false,
71
+		Private:     true,
72
+	})
68 73
 
69 74
 	if err := d.generateEnvConfig(c); err != nil {
70 75
 		return -1, err
... ...
@@ -440,7 +445,12 @@ func (d *driver) generateEnvConfig(c *execdriver.Command) error {
440 440
 		return err
441 441
 	}
442 442
 	p := path.Join(d.root, "containers", c.ID, "config.env")
443
-	c.Mounts = append(c.Mounts, execdriver.Mount{p, "/.dockerenv", false, true})
443
+	c.Mounts = append(c.Mounts, execdriver.Mount{
444
+		Source:      p,
445
+		Destination: "/.dockerenv",
446
+		Writable:    false,
447
+		Private:     true,
448
+	})
444 449
 
445 450
 	return ioutil.WriteFile(p, data, 0600)
446 451
 }
... ...
@@ -61,6 +61,6 @@ func initializer() {
61 61
 }
62 62
 
63 63
 func writeError(err error) {
64
-	fmt.Sprint(os.Stderr, err)
64
+	fmt.Fprint(os.Stderr, err)
65 65
 	os.Exit(1)
66 66
 }
... ...
@@ -71,7 +71,7 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) engine.Status {
71 71
 			var err error
72 72
 			lines, err = strconv.Atoi(tail)
73 73
 			if err != nil {
74
-				utils.Errorf("Failed to parse tail %s, error: %v, show all logs", err)
74
+				utils.Errorf("Failed to parse tail %s, error: %v, show all logs", tail, err)
75 75
 				lines = -1
76 76
 			}
77 77
 		}
... ...
@@ -1,11 +1,12 @@
1 1
 package portmapper
2 2
 
3 3
 import (
4
+	"net"
5
+	"testing"
6
+
4 7
 	"github.com/docker/docker/daemon/networkdriver/portallocator"
5 8
 	"github.com/docker/docker/pkg/iptables"
6 9
 	"github.com/docker/docker/pkg/proxy"
7
-	"net"
8
-	"testing"
9 10
 )
10 11
 
11 12
 func init() {
... ...
@@ -138,7 +139,7 @@ func TestMapAllPortsSingleInterface(t *testing.T) {
138 138
 		}
139 139
 
140 140
 		if _, err := Map(srcAddr1, dstIp1, portallocator.BeginPortRange); err == nil {
141
-			t.Fatal("Port %d should be bound but is not", portallocator.BeginPortRange)
141
+			t.Fatalf("Port %d should be bound but is not", portallocator.BeginPortRange)
142 142
 		}
143 143
 
144 144
 		for _, val := range hosts {
... ...
@@ -37,7 +37,7 @@ func TestStateRunStop(t *testing.T) {
37 37
 			t.Fatalf("Pid %v, expected %v", runPid, i+100)
38 38
 		}
39 39
 		if pid, err := s.WaitRunning(-1 * time.Second); err != nil || pid != i+100 {
40
-			t.Fatal("WaitRunning returned pid: %v, err: %v, expected pid: %v, err: %v", pid, err, i+100, nil)
40
+			t.Fatalf("WaitRunning returned pid: %v, err: %v, expected pid: %v, err: %v", pid, err, i+100, nil)
41 41
 		}
42 42
 
43 43
 		stopped := make(chan struct{})
... ...
@@ -68,7 +68,7 @@ func TestStateRunStop(t *testing.T) {
68 68
 			t.Fatalf("ExitCode %v, expected %v", exitCode, i)
69 69
 		}
70 70
 		if exitCode, err := s.WaitStop(-1 * time.Second); err != nil || exitCode != i {
71
-			t.Fatal("WaitStop returned exitCode: %v, err: %v, expected exitCode: %v, err: %v", exitCode, err, i, nil)
71
+			t.Fatalf("WaitStop returned exitCode: %v, err: %v, expected exitCode: %v, err: %v", exitCode, err, i, nil)
72 72
 		}
73 73
 	}
74 74
 }
... ...
@@ -1836,7 +1836,7 @@ func TestBuildFromGIT(t *testing.T) {
1836 1836
 		t.Fatal(err)
1837 1837
 	}
1838 1838
 	if res != "docker" {
1839
-		t.Fatal("Maintainer should be docker, got %s", res)
1839
+		t.Fatalf("Maintainer should be docker, got %s", res)
1840 1840
 	}
1841 1841
 	logDone("build - build from GIT")
1842 1842
 }
... ...
@@ -76,7 +76,7 @@ func TestCLIGetEventsContainerEvents(t *testing.T) {
76 76
 	eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
77 77
 	out, exitCode, err := runCommandWithOutput(eventsCmd)
78 78
 	if exitCode != 0 || err != nil {
79
-		t.Fatal("Failed to get events with exit code %d: %s", exitCode, err)
79
+		t.Fatalf("Failed to get events with exit code %d: %s", exitCode, err)
80 80
 	}
81 81
 	events := strings.Split(out, "\n")
82 82
 	events = events[:len(events)-1]
... ...
@@ -119,7 +119,7 @@ func TestCLIGetEventsImageUntagDelete(t *testing.T) {
119 119
 	eventsCmd := exec.Command(dockerBinary, "events", "--since=0", fmt.Sprintf("--until=%d", time.Now().Unix()))
120 120
 	out, exitCode, err := runCommandWithOutput(eventsCmd)
121 121
 	if exitCode != 0 || err != nil {
122
-		t.Fatal("Failed to get events with exit code %d: %s", exitCode, err)
122
+		t.Fatalf("Failed to get events with exit code %d: %s", exitCode, err)
123 123
 	}
124 124
 	events := strings.Split(out, "\n")
125 125
 	t.Log(events)
... ...
@@ -102,7 +102,7 @@ func TestContainerOrphaning(t *testing.T) {
102 102
 		t.Fatalf("%v: %s", err, out)
103 103
 	}
104 104
 	if !strings.Contains(out, img1) {
105
-		t.Fatal("Orphaned container (could not find '%s' in docker images): %s", img1, out)
105
+		t.Fatalf("Orphaned container (could not find '%s' in docker images): %s", img1, out)
106 106
 	}
107 107
 
108 108
 	deleteAllContainers()