Browse code

Merge remote-tracking branch 'dominikh/minor-code-touchups'

Solomon Hykes authored on 2013/04/05 08:20:37
Showing 5 changed files
... ...
@@ -99,7 +99,7 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout io.Writer, args ...strin
99 99
 			}
100 100
 			if err != nil {
101 101
 				if err != io.EOF {
102
-					fmt.Fprint(stdout, "Read error: %v\n", err)
102
+					fmt.Fprintf(stdout, "Read error: %v\n", err)
103 103
 				}
104 104
 				break
105 105
 			}
... ...
@@ -512,10 +512,9 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string
512 512
 				return err
513 513
 			}
514 514
 			return nil
515
-		} else {
516
-			return err
517 515
 		}
518
-		return nil
516
+
517
+		return err
519 518
 	}
520 519
 	err = srv.runtime.graph.PushImage(stdout, img, srv.runtime.authConfig)
521 520
 	if err != nil {
... ...
@@ -652,7 +652,7 @@ func (container *Container) WaitTimeout(timeout time.Duration) error {
652 652
 	case <-done:
653 653
 		return nil
654 654
 	}
655
-	return nil
655
+	panic("unreachable")
656 656
 }
657 657
 
658 658
 func (container *Container) EnsureMounted() error {
... ...
@@ -187,7 +187,7 @@ func (alloc *PortAllocator) Release(port int) error {
187 187
 	default:
188 188
 		return errors.New("Too many ports have been released")
189 189
 	}
190
-	return nil
190
+	panic("unreachable")
191 191
 }
192 192
 
193 193
 func newPortAllocator(start, end int) (*PortAllocator, error) {
... ...
@@ -22,10 +22,10 @@ func nuke(runtime *Runtime) error {
22 22
 	var wg sync.WaitGroup
23 23
 	for _, container := range runtime.List() {
24 24
 		wg.Add(1)
25
-		go func() {
26
-			container.Kill()
27
-			wg.Add(-1)
28
-		}()
25
+		go func(c *Container) {
26
+			c.Kill()
27
+			wg.Done()
28
+		}(container)
29 29
 	}
30 30
 	wg.Wait()
31 31
 	return os.RemoveAll(runtime.root)
... ...
@@ -91,7 +91,6 @@ func newTestRuntime() (*Runtime, error) {
91 91
 		return nil, err
92 92
 	}
93 93
 	if err := CopyDirectory(unitTestStoreBase, root); err != nil {
94
-		panic(err)
95 94
 		return nil, err
96 95
 	}
97 96
 
... ...
@@ -202,7 +202,7 @@ func (r *bufReader) Read(p []byte) (n int, err error) {
202 202
 		}
203 203
 		r.wait.Wait()
204 204
 	}
205
-	return
205
+	panic("unreachable")
206 206
 }
207 207
 
208 208
 func (r *bufReader) Close() error {