mirror of
https://github.com/pcvolkmer/docker-pps.git
synced 2025-04-19 09:46:50 +00:00
Format host string instead of concatenation
This commit is contained in:
parent
7999bc6b8f
commit
f7c5adf566
4
main.go
4
main.go
@ -178,13 +178,13 @@ func getClientOpts(h *string) []client.Opt {
|
|||||||
|
|
||||||
// TCP/HTTP
|
// TCP/HTTP
|
||||||
if !strings.Contains(*h, "//") {
|
if !strings.Contains(*h, "//") {
|
||||||
*h = "tcp://" + *h
|
*h = fmt.Sprintf("tcp://%s", *h)
|
||||||
}
|
}
|
||||||
if u, err := client.ParseHostURL(*h); err == nil {
|
if u, err := client.ParseHostURL(*h); err == nil {
|
||||||
if u.Port() != "" {
|
if u.Port() != "" {
|
||||||
opts = append(opts, client.WithHost(*h))
|
opts = append(opts, client.WithHost(*h))
|
||||||
} else {
|
} else {
|
||||||
opts = append(opts, client.WithHost(*h+":2375"))
|
opts = append(opts, client.WithHost(fmt.Sprintf("%s:2375", *h)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user