Commit 36cbfbf3 authored by Joshua Gutow's avatar Joshua Gutow Committed by GitHub

Use net.JoinHostPort instead of fmt.Sprintf (#2622)

fmt.Sprintf is discouraged from being used to create network addresses.
parent df03ef37
...@@ -3,9 +3,9 @@ package node ...@@ -3,9 +3,9 @@ package node
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"net" "net"
"net/http" "net/http"
"strconv"
"github.com/ethereum-optimism/optimism/op-node/p2p" "github.com/ethereum-optimism/optimism/op-node/p2p"
...@@ -32,7 +32,7 @@ type rpcServer struct { ...@@ -32,7 +32,7 @@ type rpcServer struct {
func newRPCServer(ctx context.Context, rpcCfg *RPCConfig, rollupCfg *rollup.Config, l2Client l2EthClient, log log.Logger, appVersion string) (*rpcServer, error) { func newRPCServer(ctx context.Context, rpcCfg *RPCConfig, rollupCfg *rollup.Config, l2Client l2EthClient, log log.Logger, appVersion string) (*rpcServer, error) {
api := newNodeAPI(rollupCfg, l2Client, log.New("rpc", "node")) api := newNodeAPI(rollupCfg, l2Client, log.New("rpc", "node"))
// TODO: extend RPC config with options for WS, IPC and HTTP RPC connections // TODO: extend RPC config with options for WS, IPC and HTTP RPC connections
endpoint := fmt.Sprintf("%s:%d", rpcCfg.ListenAddr, rpcCfg.ListenPort) endpoint := net.JoinHostPort(rpcCfg.ListenAddr, strconv.Itoa(rpcCfg.ListenPort))
r := &rpcServer{ r := &rpcServer{
endpoint: endpoint, endpoint: endpoint,
apis: []rpc.API{{ apis: []rpc.API{{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment