Bump Go from 1.24.6 to 1.25.4 (#1930)

* Bump Go to version from 1.24.6 to 1.25.4

* fix: use net.JoinHostPort for IPv6 compatibility

Fix IPv6 address formatting in namespace-pinger.go by replacing
fmt.Sprintf with net.JoinHostPort, which correctly handles both
IPv4 and IPv6 addresses.

Changes:
- PingTCP: Use net.JoinHostPort for client connections
- startTCPEchoServer: Use net.JoinHostPort for server listener

This fixes go vet errors introduced by Go 1.25's stricter checks:
  address format "%s:%d" does not work with IPv6

IPv4 example: 192.168.1.1:8080
IPv6 example: [::1]:8080 (brackets added automatically)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Mullen <nwmullen@gmail.com>
This commit is contained in:
replicated-ci
2025-11-21 17:54:22 +00:00
committed by GitHub
parent aa13c2e31e
commit 73ac499d3e
2 changed files with 4 additions and 3 deletions

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/replicatedhq/troubleshoot module github.com/replicatedhq/troubleshoot
go 1.24.6 go 1.25.4
require ( require (
github.com/Masterminds/sprig/v3 v3.3.0 github.com/Masterminds/sprig/v3 v3.3.0

View File

@@ -5,6 +5,7 @@ package namespaces
import ( import (
"fmt" "fmt"
"net" "net"
"strconv"
"time" "time"
) )
@@ -51,7 +52,7 @@ func (n *NamespacePinger) PingUDP(dst net.IP) error {
func (n *NamespacePinger) PingTCP(dst net.IP) error { func (n *NamespacePinger) PingTCP(dst net.IP) error {
n.cfg.Logf("reaching to %q from %q with tcp", dst, n.InternalIP) n.cfg.Logf("reaching to %q from %q with tcp", dst, n.InternalIP)
pinger := func() error { pinger := func() error {
addr := fmt.Sprintf("%s:%d", dst, n.cfg.Port) addr := net.JoinHostPort(dst.String(), strconv.Itoa(n.cfg.Port))
conn, err := net.DialTimeout("tcp", addr, n.cfg.Timeout) conn, err := net.DialTimeout("tcp", addr, n.cfg.Timeout)
if err != nil { if err != nil {
return fmt.Errorf("error dialing tcp: %w", err) return fmt.Errorf("error dialing tcp: %w", err)
@@ -90,7 +91,7 @@ func (n *NamespacePinger) StartTCPEchoServer(errors chan error) {
// received, the server ends. Callers must wait until the ready channel is // received, the server ends. Callers must wait until the ready channel is
// closed before they can start sending packets. // closed before they can start sending packets.
func (n *NamespacePinger) startTCPEchoServer(ready chan struct{}) (err error) { func (n *NamespacePinger) startTCPEchoServer(ready chan struct{}) (err error) {
addr := fmt.Sprintf("%s:%d", n.InternalIP, n.cfg.Port) addr := net.JoinHostPort(n.InternalIP.String(), strconv.Itoa(n.cfg.Port))
n.cfg.Logf("starting tcp echo server on namespace %q(%q)", n.name, addr) n.cfg.Logf("starting tcp echo server on namespace %q(%q)", n.name, addr)
if err = n.Join(); err != nil { if err = n.Join(); err != nil {