linting: host:port in url should be constructed with net.JoinHostPort
integration-cli/docker_cli_daemon_test.go:545:54: host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf (nosprintfhostport) cmdArgs = append(cmdArgs, "--tls=false", "--host", fmt.Sprintf("tcp://%s:%s", l.daemon, l.port)) ^ opts/hosts_test.go:35:31: 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), ^ opts/hosts_test.go:91:30: host:port in url should be constructed with net.JoinHostPort and not directly with fmt.Sprintf (nosprintfhostport) ":5555": fmt.Sprintf("tcp://%s:5555", DefaultHTTPHost), ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit306b8c89e8
) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commite9e7491f2b
) Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
parent
2ad43faba5
commit
d855447c46
2 changed files with 9 additions and 9 deletions
|
@ -541,7 +541,7 @@ func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *testing.T) {
|
|||
|
||||
cmdArgs := make([]string, 0, len(listeningPorts)*2)
|
||||
for _, l := range listeningPorts {
|
||||
cmdArgs = append(cmdArgs, "--tls=false", "--host", fmt.Sprintf("tcp://%s:%s", l.daemon, l.port))
|
||||
cmdArgs = append(cmdArgs, "--tls=false", "--host", "tcp://"+net.JoinHostPort(l.daemon, l.port))
|
||||
}
|
||||
|
||||
s.d.StartWithBusybox(c, cmdArgs...)
|
||||
|
|
|
@ -23,13 +23,13 @@ func TestParseHost(t *testing.T) {
|
|||
"fd://something": "fd://something",
|
||||
"tcp://host:": fmt.Sprintf("tcp://host:%d", DefaultHTTPPort),
|
||||
"tcp://": DefaultTCPHost,
|
||||
"tcp://:2375": fmt.Sprintf("tcp://%s:2375", DefaultHTTPHost),
|
||||
"tcp://:2376": fmt.Sprintf("tcp://%s:2376", DefaultHTTPHost),
|
||||
"tcp://:2375": fmt.Sprintf("tcp://%s:2375", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
"tcp://:2376": fmt.Sprintf("tcp://%s:2376", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
"tcp://0.0.0.0:8080": "tcp://0.0.0.0:8080",
|
||||
"tcp://192.168.0.0:12000": "tcp://192.168.0.0:12000",
|
||||
"tcp://192.168:8080": "tcp://192.168:8080",
|
||||
"tcp://0.0.0.0:1234567890": "tcp://0.0.0.0:1234567890", // yeah it's valid :P
|
||||
" tcp://:7777/path ": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
|
||||
"tcp://0.0.0.0:1234567890": "tcp://0.0.0.0:1234567890", // yeah it's valid :P
|
||||
" tcp://:7777/path ": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
"tcp://docker.com:2375": "tcp://docker.com:2375",
|
||||
"unix://": "unix://" + DefaultUnixSocket,
|
||||
"unix://path/to/socket": "unix://path/to/socket",
|
||||
|
@ -69,11 +69,11 @@ func TestParseDockerDaemonHost(t *testing.T) {
|
|||
"[::1]:5555/path": "tcp://[::1]:5555/path",
|
||||
"[0:0:0:0:0:0:0:1]:": "tcp://[0:0:0:0:0:0:0:1]:2375",
|
||||
"[0:0:0:0:0:0:0:1]:5555/path": "tcp://[0:0:0:0:0:0:0:1]:5555/path",
|
||||
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost),
|
||||
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost),
|
||||
":6666": fmt.Sprintf("tcp://%s:6666", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
":6666/path": fmt.Sprintf("tcp://%s:6666/path", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
"tcp://": DefaultTCPHost,
|
||||
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost),
|
||||
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost),
|
||||
"tcp://:7777": fmt.Sprintf("tcp://%s:7777", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
"tcp://:7777/path": fmt.Sprintf("tcp://%s:7777/path", DefaultHTTPHost), //nolint:nosprintfhostport // sprintf is more readable for this case.
|
||||
"unix:///run/docker.sock": "unix:///run/docker.sock",
|
||||
"unix://": "unix://" + DefaultUnixSocket,
|
||||
"fd://": "fd://",
|
||||
|
|
Loading…
Reference in a new issue