Skip to content

Commit 9d404e5

Browse files
committed
refactor: use JoinHostPort for vnc tcp dialing
Replace manual `"%s:%d"` address formatting with `net.JoinHostPort` when dialing VNC. This ensures host/port strings are constructed correctly (including IPv6 hosts) and avoids malformed TCP target addresses. Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
1 parent 9b03151 commit 9d404e5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

builder/vmware/common/step_vnc_connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (s *StepVNCConnect) ConnectVNC(ctx context.Context, state multistep.StateBa
4646
vncPort := state.Get("vnc_port").(int)
4747
vncPassword := state.Get("vnc_password")
4848

49-
nc, err := net.Dial("tcp", fmt.Sprintf("%s:%d", vncIp, vncPort))
49+
nc, err := net.Dial("tcp", net.JoinHostPort(vncIp, fmt.Sprintf("%d", vncPort)))
5050
if err != nil {
5151
err := fmt.Errorf("error connecting to VNC: %s", err)
5252
state.Put("error", err)

0 commit comments

Comments
 (0)