diff --git a/go.mod b/go.mod index 8b039f996b0d..a5ac438eba66 100644 --- a/go.mod +++ b/go.mod @@ -114,7 +114,7 @@ require ( github.com/spf13/pflag v1.0.10 github.com/spf13/viper v1.12.0 github.com/ssgreg/nlreturn/v2 v2.2.1 - github.com/stbenjam/no-sprintf-host-port v0.2.0 + github.com/stbenjam/no-sprintf-host-port v0.3.1 github.com/stretchr/testify v1.11.1 github.com/tetafro/godot v1.5.4 github.com/timakin/bodyclose v0.0.0-20241222091800-1db5c5ca4d67 diff --git a/go.sum b/go.sum index a8529bac9346..6cd49442cd43 100644 --- a/go.sum +++ b/go.sum @@ -563,8 +563,8 @@ github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0= github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= -github.com/stbenjam/no-sprintf-host-port v0.2.0 h1:i8pxvGrt1+4G0czLr/WnmyH7zbZ8Bg8etvARQ1rpyl4= -github.com/stbenjam/no-sprintf-host-port v0.2.0/go.mod h1:eL0bQ9PasS0hsyTyfTjjG+E80QIyPnBVQbYZyv20Jfk= +github.com/stbenjam/no-sprintf-host-port v0.3.1 h1:AyX7+dxI4IdLBPtDbsGAyqiTSLpCP9hWRrXQDU4Cm/g= +github.com/stbenjam/no-sprintf-host-port v0.3.1/go.mod h1:ODbZesTCHMVKthBHskvUUexdcNHAQRXk9NpSsL8p/HQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= diff --git a/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport.go b/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport.go index 065519e7de5f..820106c3eb4b 100644 --- a/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport.go +++ b/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport.go @@ -28,19 +28,19 @@ func _() { _ = fmt.Sprintf("http://example.com:9211") - _ = fmt.Sprintf("gopher://%s:%d", "myHost", 70) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" + _ = fmt.Sprintf("gopher://%s:%d", "myHost", 70) - _ = fmt.Sprintf("telnet+ssl://%s:%d", "myHost", 23) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" + _ = fmt.Sprintf("telnet+ssl://%s:%d", "myHost", 23) - _ = fmt.Sprintf("weird3.6://%s:%d", "myHost", 23) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" + _ = fmt.Sprintf("weird3.6://%s:%d", "myHost", 23) _ = fmt.Sprintf("https://user@%s:%d", "myHost", 8443) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" _ = fmt.Sprintf("postgres://%s:%s@%s:5050/%s", "foo", "bar", "baz", "qux") // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" - _ = fmt.Sprintf("https://%s:%d", "myHost", 8443) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" + _ = fmt.Sprintf("https://%s:%d", "myHost", 8443) - _ = fmt.Sprintf("https://%s:9211", "myHost") // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" + _ = fmt.Sprintf("https://%s:9211", "myHost") ip := "fd00::1" _ = fmt.Sprintf("http://%s:1936/healthz", ip) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" diff --git a/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport_cgo.go b/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport_cgo.go index b7548d10ec9a..d11b7dd1d3a7 100644 --- a/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport_cgo.go +++ b/pkg/golinters/nosprintfhostport/testdata/nosprintfhostport_cgo.go @@ -23,5 +23,6 @@ func _() { } func _() { - _ = fmt.Sprintf("gopher://%s:%d", "myHost", 70) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" + ip := "fd00::1" + _ = fmt.Sprintf("http://%s:1936/healthz", ip) // want "host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf" }