From e9c90834fa357237d89dc412bba24c54897853c8 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 7 Feb 2025 22:46:13 +0100 Subject: [PATCH] opts: host:port should be constructed with net.JoinHostPort (nosprintfhostport) opts/hosts_test.go:110:30: host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf (nosprintfhostport) "tcp://:5555": fmt.Sprintf("tcp://%s:5555", DefaultHTTPHost), ^ Signed-off-by: Sebastiaan van Stijn --- opts/hosts_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opts/hosts_test.go b/opts/hosts_test.go index 9e217446dd..f7c16e2bab 100644 --- a/opts/hosts_test.go +++ b/opts/hosts_test.go @@ -107,7 +107,7 @@ func TestParseDockerDaemonHost(t *testing.T) { "npipe://": "npipe://" + DefaultNamedPipe, "npipe:////./pipe/foo": "npipe:////./pipe/foo", "tcp://": DefaultTCPHost, - "tcp://:5555": fmt.Sprintf("tcp://%s:5555", DefaultHTTPHost), + "tcp://:5555": fmt.Sprintf("tcp://%s:5555", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case. "tcp://[::1]": fmt.Sprintf("tcp://[::1]:%d", DefaultHTTPPort), "tcp://[::1]:": fmt.Sprintf("tcp://[::1]:%d", DefaultHTTPPort), "tcp://[::1]:5555": "tcp://[::1]:5555",