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" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strconv"
"strings" "strings"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -264,7 +265,7 @@ func (c *Config) HTTPEndpoint() string {
if c.HTTPHost == "" { if c.HTTPHost == "" {
return "" 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. // DefaultHTTPEndpoint returns the HTTP endpoint used by default.
@ -279,7 +280,7 @@ func (c *Config) WSEndpoint() string {
if c.WSHost == "" { if c.WSHost == "" {
return "" 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. // DefaultWSEndpoint returns the websocket endpoint used by default.