Skip to content

Commit

Permalink
test: use net.JoinHostPort instead of Sprintf
Browse files Browse the repository at this point in the history
This fixes the linter warning:
	internal/upload/docker/docker_test.go:31:19: host:port in url should be
	constructed with net.JoinHostPort and not directly with fmt.Sprintf
	(nosprintfhostport)
  • Loading branch information
fho committed Dec 13, 2023
1 parent 9d2652c commit 3cf33cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/upload/docker/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"encoding/base64"
"fmt"
"net"
"testing"

docker "github.com/fsouza/go-dockerclient"
Expand All @@ -28,7 +29,7 @@ func TestGetAuth(t *testing.T) {

const myRegistryHostname = "myregistry.com"
const myRegistryPort = dockerRegistryDefaultPort
myRegistryURL := fmt.Sprintf("https://%s:%s", myRegistryHostname, myRegistryPort)
myRegistryURL := fmt.Sprintf("https://%s", net.JoinHostPort(myRegistryHostname, myRegistryPort))
const myRegistryUser = "hugo"
const myRegistryPasswd = "hello"

Expand Down

0 comments on commit 3cf33cb

Please sign in to comment.