diff --git a/commands.go b/commands.go index ab21f07e72..f80589e556 100644 --- a/commands.go +++ b/commands.go @@ -99,7 +99,7 @@ func (srv *Server) CmdLogin(stdin io.ReadCloser, stdout io.Writer, args ...strin } if err != nil { if err != io.EOF { - fmt.Fprint(stdout, "Read error: %v\n", err) + fmt.Fprintf(stdout, "Read error: %v\n", err) } break } @@ -512,10 +512,9 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string return err } return nil - } else { - return err } - return nil + + return err } err = srv.runtime.graph.PushImage(stdout, img, srv.runtime.authConfig) if err != nil { diff --git a/container.go b/container.go index 342ce827dc..07c8fc1c8e 100644 --- a/container.go +++ b/container.go @@ -652,7 +652,7 @@ func (container *Container) WaitTimeout(timeout time.Duration) error { case <-done: return nil } - return nil + panic("unreachable") } func (container *Container) EnsureMounted() error { diff --git a/network.go b/network.go index 9817bb84b3..5e5c52dd0b 100644 --- a/network.go +++ b/network.go @@ -187,7 +187,7 @@ func (alloc *PortAllocator) Release(port int) error { default: return errors.New("Too many ports have been released") } - return nil + panic("unreachable") } func newPortAllocator(start, end int) (*PortAllocator, error) { diff --git a/runtime_test.go b/runtime_test.go index 0ec7220312..3cdcbe3b39 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -22,10 +22,10 @@ func nuke(runtime *Runtime) error { var wg sync.WaitGroup for _, container := range runtime.List() { wg.Add(1) - go func() { - container.Kill() - wg.Add(-1) - }() + go func(c *Container) { + c.Kill() + wg.Done() + }(container) } wg.Wait() return os.RemoveAll(runtime.root) @@ -91,7 +91,6 @@ func newTestRuntime() (*Runtime, error) { return nil, err } if err := CopyDirectory(unitTestStoreBase, root); err != nil { - panic(err) return nil, err } diff --git a/utils.go b/utils.go index e295239f7f..5ee84239b1 100644 --- a/utils.go +++ b/utils.go @@ -202,7 +202,7 @@ func (r *bufReader) Read(p []byte) (n int, err error) { } r.wait.Wait() } - return + panic("unreachable") } func (r *bufReader) Close() error {