- remove intermediate err vars
- move "multiplexed" variable closer to where used
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -33,12 +33,10 @@ func (daemon *Daemon) ContainerAttach(prefixOrName string, req *backend.Containe |
| 33 | 33 |
return err |
| 34 | 34 |
} |
| 35 | 35 |
if ctr.IsPaused() {
|
| 36 |
- err := fmt.Errorf("container %s is paused, unpause the container before attach", prefixOrName)
|
|
| 37 |
- return errdefs.Conflict(err) |
|
| 36 |
+ return errdefs.Conflict(fmt.Errorf("container %s is paused, unpause the container before attach", prefixOrName))
|
|
| 38 | 37 |
} |
| 39 | 38 |
if ctr.IsRestarting() {
|
| 40 |
- err := fmt.Errorf("container %s is restarting, wait until the container is running", prefixOrName)
|
|
| 41 |
- return errdefs.Conflict(err) |
|
| 39 |
+ return errdefs.Conflict(fmt.Errorf("container %s is restarting, wait until the container is running", prefixOrName))
|
|
| 42 | 40 |
} |
| 43 | 41 |
|
| 44 | 42 |
cfg := stream.AttachConfig{
|
| ... | ... |
@@ -51,8 +49,6 @@ func (daemon *Daemon) ContainerAttach(prefixOrName string, req *backend.Containe |
| 51 | 51 |
} |
| 52 | 52 |
ctr.StreamConfig.AttachStreams(&cfg) |
| 53 | 53 |
|
| 54 |
- multiplexed := !ctr.Config.Tty && req.MuxStreams |
|
| 55 |
- |
|
| 56 | 54 |
clientCtx, closeNotify := context.WithCancel(context.Background()) |
| 57 | 55 |
defer closeNotify() |
| 58 | 56 |
go func() {
|
| ... | ... |
@@ -68,6 +64,7 @@ func (daemon *Daemon) ContainerAttach(prefixOrName string, req *backend.Containe |
| 68 | 68 |
} |
| 69 | 69 |
}() |
| 70 | 70 |
|
| 71 |
+ multiplexed := !ctr.Config.Tty && req.MuxStreams |
|
| 71 | 72 |
inStream, outStream, errStream, err := req.GetStreams(multiplexed, closeNotify) |
| 72 | 73 |
if err != nil {
|
| 73 | 74 |
return err |