replace unreachable returns with panics

Not only is this a more common idiom, it'll make finding bugs easier,
and it'll make porting to Go 1.1 easier.

Go 1.1 will not require the final return or panic because it has a
notion of terminating statements.
Upstream-commit: 22f1cc955dbf25132e69d126f8db0e5498bffbd2
Component: engine
This commit is contained in:
Dominik Honnef
2013-04-03 11:18:23 +02:00
parent 668c8b4472
commit d6aac87dba
3 changed files with 3 additions and 3 deletions

View File

@ -626,7 +626,7 @@ func (container *Container) WaitTimeout(timeout time.Duration) error {
case <-done:
return nil
}
return nil
panic("unreachable")
}
func (container *Container) EnsureMounted() error {

View File

@ -184,7 +184,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) {

View File

@ -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 {