Signed-off-by: Elena Morozova <lelenanam@gmail.com>
| ... | ... |
@@ -27,9 +27,7 @@ func (n *networkRouter) getNetworksList(ctx context.Context, w http.ResponseWrit |
| 27 | 27 |
list := []types.NetworkResource{}
|
| 28 | 28 |
|
| 29 | 29 |
if nr, err := n.clusterProvider.GetNetworks(); err == nil {
|
| 30 |
- for _, nw := range nr {
|
|
| 31 |
- list = append(list, nw) |
|
| 32 |
- } |
|
| 30 |
+ list = append(list, nr...) |
|
| 33 | 31 |
} |
| 34 | 32 |
|
| 35 | 33 |
// Combine the network list returned by Docker daemon if it is not already |
| ... | ... |
@@ -146,9 +146,7 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
| 146 | 146 |
// InitRouter initializes the list of routers for the server. |
| 147 | 147 |
// This method also enables the Go profiler if enableProfiler is true. |
| 148 | 148 |
func (s *Server) InitRouter(enableProfiler bool, routers ...router.Router) {
|
| 149 |
- for _, r := range routers {
|
|
| 150 |
- s.routers = append(s.routers, r) |
|
| 151 |
- } |
|
| 149 |
+ s.routers = append(s.routers, routers...) |
|
| 152 | 150 |
|
| 153 | 151 |
m := s.createMux() |
| 154 | 152 |
if enableProfiler {
|
| ... | ... |
@@ -56,9 +56,7 @@ func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]s |
| 56 | 56 |
child.Config.ExposedPorts, |
| 57 | 57 |
) |
| 58 | 58 |
|
| 59 |
- for _, envVar := range link.ToEnv() {
|
|
| 60 |
- env = append(env, envVar) |
|
| 61 |
- } |
|
| 59 |
+ env = append(env, link.ToEnv()...) |
|
| 62 | 60 |
} |
| 63 | 61 |
|
| 64 | 62 |
return env, nil |
| ... | ... |
@@ -583,9 +583,7 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
|
| 583 | 583 |
devname := info.DevName() |
| 584 | 584 |
|
| 585 | 585 |
args := []string{}
|
| 586 |
- for _, arg := range devices.mkfsArgs {
|
|
| 587 |
- args = append(args, arg) |
|
| 588 |
- } |
|
| 586 |
+ args = append(args, devices.mkfsArgs...) |
|
| 589 | 587 |
|
| 590 | 588 |
args = append(args, devname) |
| 591 | 589 |
|
| ... | ... |
@@ -75,9 +75,7 @@ func (ctx *Context) Hostname() (string, error) {
|
| 75 | 75 |
// arguments. |
| 76 | 76 |
func (ctx *Context) Command() string {
|
| 77 | 77 |
terms := []string{ctx.ContainerEntrypoint}
|
| 78 |
- for _, arg := range ctx.ContainerArgs {
|
|
| 79 |
- terms = append(terms, arg) |
|
| 80 |
- } |
|
| 78 |
+ terms = append(terms, ctx.ContainerArgs...) |
|
| 81 | 79 |
command := strings.Join(terms, " ") |
| 82 | 80 |
return command |
| 83 | 81 |
} |
| ... | ... |
@@ -333,9 +333,7 @@ func (s *DockerSuite) TestImagesFormat(c *check.C) {
|
| 333 | 333 |
|
| 334 | 334 |
expected := []string{"myimage", "myimage"}
|
| 335 | 335 |
var names []string |
| 336 |
- for _, l := range lines {
|
|
| 337 |
- names = append(names, l) |
|
| 338 |
- } |
|
| 336 |
+ names = append(names, lines...) |
|
| 339 | 337 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
| 340 | 338 |
} |
| 341 | 339 |
|
| ... | ... |
@@ -288,9 +288,7 @@ func (s *DockerSuite) TestNetworkLsFormat(c *check.C) {
|
| 288 | 288 |
|
| 289 | 289 |
expected := []string{"bridge", "host", "none"}
|
| 290 | 290 |
var names []string |
| 291 |
- for _, l := range lines {
|
|
| 292 |
- names = append(names, l) |
|
| 293 |
- } |
|
| 291 |
+ names = append(names, lines...) |
|
| 294 | 292 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
| 295 | 293 |
} |
| 296 | 294 |
|
| ... | ... |
@@ -312,9 +310,7 @@ func (s *DockerSuite) TestNetworkLsFormatDefaultFormat(c *check.C) {
|
| 312 | 312 |
|
| 313 | 313 |
expected := []string{"bridge default", "host default", "none default"}
|
| 314 | 314 |
var names []string |
| 315 |
- for _, l := range lines {
|
|
| 316 |
- names = append(names, l) |
|
| 317 |
- } |
|
| 315 |
+ names = append(names, lines...) |
|
| 318 | 316 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
| 319 | 317 |
} |
| 320 | 318 |
|
| ... | ... |
@@ -566,9 +566,7 @@ func (s *DockerSuite) TestPsFormatMultiNames(c *check.C) {
|
| 566 | 566 |
lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
| 567 | 567 |
expected := []string{"parent", "child,parent/linkedone"}
|
| 568 | 568 |
var names []string |
| 569 |
- for _, l := range lines {
|
|
| 570 |
- names = append(names, l) |
|
| 571 |
- } |
|
| 569 |
+ names = append(names, lines...) |
|
| 572 | 570 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with non-truncated names: %v, got: %v", expected, names))
|
| 573 | 571 |
|
| 574 | 572 |
//now list without turning off truncation and make sure we only get the non-link names |
| ... | ... |
@@ -576,9 +574,7 @@ func (s *DockerSuite) TestPsFormatMultiNames(c *check.C) {
|
| 576 | 576 |
lines = strings.Split(strings.TrimSpace(string(out)), "\n") |
| 577 | 577 |
expected = []string{"parent", "child"}
|
| 578 | 578 |
var truncNames []string |
| 579 |
- for _, l := range lines {
|
|
| 580 |
- truncNames = append(truncNames, l) |
|
| 581 |
- } |
|
| 579 |
+ truncNames = append(truncNames, lines...) |
|
| 582 | 580 |
c.Assert(expected, checker.DeepEquals, truncNames, check.Commentf("Expected array with truncated names: %v, got: %v", expected, truncNames))
|
| 583 | 581 |
} |
| 584 | 582 |
|
| ... | ... |
@@ -592,9 +588,7 @@ func (s *DockerSuite) TestPsNamesMultipleTime(c *check.C) {
|
| 592 | 592 |
lines := strings.Split(strings.TrimSpace(string(out)), "\n") |
| 593 | 593 |
expected := []string{"test2 test2", "test1 test1"}
|
| 594 | 594 |
var names []string |
| 595 |
- for _, l := range lines {
|
|
| 596 |
- names = append(names, l) |
|
| 597 |
- } |
|
| 595 |
+ names = append(names, lines...) |
|
| 598 | 596 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with names displayed twice: %v, got: %v", expected, names))
|
| 599 | 597 |
} |
| 600 | 598 |
|
| ... | ... |
@@ -106,9 +106,7 @@ func (s *DockerSuite) TestVolumeLsFormat(c *check.C) {
|
| 106 | 106 |
|
| 107 | 107 |
expected := []string{"aaa", "soo", "test"}
|
| 108 | 108 |
var names []string |
| 109 |
- for _, l := range lines {
|
|
| 110 |
- names = append(names, l) |
|
| 111 |
- } |
|
| 109 |
+ names = append(names, lines...) |
|
| 112 | 110 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
| 113 | 111 |
} |
| 114 | 112 |
|
| ... | ... |
@@ -132,9 +130,7 @@ func (s *DockerSuite) TestVolumeLsFormatDefaultFormat(c *check.C) {
|
| 132 | 132 |
|
| 133 | 133 |
expected := []string{"aaa default", "soo default", "test default"}
|
| 134 | 134 |
var names []string |
| 135 |
- for _, l := range lines {
|
|
| 136 |
- names = append(names, l) |
|
| 137 |
- } |
|
| 135 |
+ names = append(names, lines...) |
|
| 138 | 136 |
c.Assert(expected, checker.DeepEquals, names, check.Commentf("Expected array with truncated names: %v, got: %v", expected, names))
|
| 139 | 137 |
} |
| 140 | 138 |
|
| ... | ... |
@@ -45,9 +45,7 @@ func parseFileContent(content []byte) []string {
|
| 45 | 45 |
// Trim additional spaces caused by above stripping. |
| 46 | 46 |
line = strings.TrimSpace(line) |
| 47 | 47 |
} |
| 48 |
- for _, ip := range discovery.Generate(line) {
|
|
| 49 |
- result = append(result, ip) |
|
| 50 |
- } |
|
| 48 |
+ result = append(result, discovery.Generate(line)...) |
|
| 51 | 49 |
} |
| 52 | 50 |
return result |
| 53 | 51 |
} |
| ... | ... |
@@ -100,9 +100,7 @@ func (opt *ThrottledeviceOpt) String() string {
|
| 100 | 100 |
// GetList returns a slice of pointers to ThrottleDevices. |
| 101 | 101 |
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
|
| 102 | 102 |
var throttledevice []*blkiodev.ThrottleDevice |
| 103 |
- for _, v := range opt.values {
|
|
| 104 |
- throttledevice = append(throttledevice, v) |
|
| 105 |
- } |
|
| 103 |
+ throttledevice = append(throttledevice, opt.values...) |
|
| 106 | 104 |
|
| 107 | 105 |
return throttledevice |
| 108 | 106 |
} |