convertExtraHostsToSwarmHosts converts an array of extra hosts in cli : into a swarmkit host format: IP_address canonical_hostname [aliases...] This assumes input value ( : ) has already been validated
(extraHosts []string)
| 531 | // |
| 532 | // This assumes input value (<host>:<ip>) has already been validated |
| 533 | func convertExtraHostsToSwarmHosts(extraHosts []string) []string { |
| 534 | hosts := make([]string, 0, len(extraHosts)) |
| 535 | for _, extraHost := range extraHosts { |
| 536 | host, ip, ok := strings.Cut(extraHost, ":") |
| 537 | if ok { |
| 538 | hosts = append(hosts, ip+" "+host) |
| 539 | } |
| 540 | } |
| 541 | return hosts |
| 542 | } |
| 543 | |
| 544 | type serviceOptions struct { |
| 545 | detach bool |
no outgoing calls
no test coverage detected
searching dependent graphs…