1
0
mirror of https://github.com/moby/moby.git synced 2025-04-18 20:44:11 +03:00

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 <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-02-07 22:46:13 +01:00
parent 0bf8c8b99e
commit e9c90834fa
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -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",