node: optimize port formatting using strconv.Itoa

This commit is contained in:
bigbear 2025-09-13 19:37:14 +02:00 committed by GitHub
parent 41f580f209
commit c9f1ccb9aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,6 +23,7 @@ import (
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"github.com/ethereum/go-ethereum/common"
@ -264,7 +265,7 @@ func (c *Config) HTTPEndpoint() string {
if c.HTTPHost == "" {
return ""
}
return net.JoinHostPort(c.HTTPHost, fmt.Sprintf("%d", c.HTTPPort))
return net.JoinHostPort(c.HTTPHost, strconv.Itoa(c.HTTPPort))
}
// DefaultHTTPEndpoint returns the HTTP endpoint used by default.
@ -279,7 +280,7 @@ func (c *Config) WSEndpoint() string {
if c.WSHost == "" {
return ""
}
return net.JoinHostPort(c.WSHost, fmt.Sprintf("%d", c.WSPort))
return net.JoinHostPort(c.WSHost, strconv.Itoa(c.WSPort))
}
// DefaultWSEndpoint returns the websocket endpoint used by default.