aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/ssh/common.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2023-05-11 22:01:31 +0100
committerPaulo Gomes <pjbgf@linux.com>2023-05-11 22:01:31 +0100
commitcb72b58b7576e28627e58338c92e61d3d41a72d7 (patch)
tree257eed760856561838bb73f20dc1c2f0aee55b2d /plumbing/transport/ssh/common.go
parent096b3cc16b547f3c0d6e4f92046945bcfac0fa14 (diff)
downloadgo-git-cb72b58b7576e28627e58338c92e61d3d41a72d7.tar.gz
*: Replace fmt.Sprintf with net.JoinHostPort
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
Diffstat (limited to 'plumbing/transport/ssh/common.go')
-rw-r--r--plumbing/transport/ssh/common.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/plumbing/transport/ssh/common.go b/plumbing/transport/ssh/common.go
index 6617d9b..1531603 100644
--- a/plumbing/transport/ssh/common.go
+++ b/plumbing/transport/ssh/common.go
@@ -212,7 +212,7 @@ func (c *command) getHostWithPort() string {
port = DefaultPort
}
- return fmt.Sprintf("%s:%d", host, port)
+ return net.JoinHostPort(host, strconv.Itoa(port))
}
func (c *command) doGetHostWithPortFromSSHConfig() (addr string, found bool) {
@@ -240,7 +240,7 @@ func (c *command) doGetHostWithPortFromSSHConfig() (addr string, found bool) {
}
}
- addr = fmt.Sprintf("%s:%d", host, port)
+ addr = net.JoinHostPort(host, strconv.Itoa(port))
return
}