1
0
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:
Paul-Christian Volkmer 2023-01-13 23:00:07 +01:00
parent 7999bc6b8f
commit f7c5adf566

View File

@ -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)