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.
| ... | ... |
@@ -184,7 +184,7 @@ func (alloc *PortAllocator) Release(port int) error {
|
| 184 | 184 |
default: |
| 185 | 185 |
return errors.New("Too many ports have been released")
|
| 186 | 186 |
} |
| 187 |
- return nil |
|
| 187 |
+ panic("unreachable")
|
|
| 188 | 188 |
} |
| 189 | 189 |
|
| 190 | 190 |
func newPortAllocator(start, end int) (*PortAllocator, error) {
|