Use net.JoinHostPort instead of Sprintf

Co-authored-by: Guangyuan Wang <wguangyuan@vmware.com>
This commit is contained in:
Christian Ang 2021-06-24 23:19:11 +00:00
parent d19d63ad7d
commit 8026729c43
1 changed files with 1 additions and 1 deletions

View File

@ -140,7 +140,7 @@ func WithLogger(logger logr.Logger) Option {
// system at the time of the request.
func WithListenPort(port uint16) Option {
return func(h *handlerState) error {
h.listenAddr = fmt.Sprintf("localhost:%d", port)
h.listenAddr = net.JoinHostPort("localhost", fmt.Sprint(port))
return nil
}
}