From 3cf33cbc7ff4283fcecc4a18a458a449ef930fec Mon Sep 17 00:00:00 2001 From: Fabian Holler Date: Wed, 13 Dec 2023 17:37:51 +0100 Subject: [PATCH] test: use net.JoinHostPort instead of Sprintf 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) --- internal/upload/docker/docker_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/upload/docker/docker_test.go b/internal/upload/docker/docker_test.go index 1942c72a5..c4942bbe6 100644 --- a/internal/upload/docker/docker_test.go +++ b/internal/upload/docker/docker_test.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/base64" "fmt" + "net" "testing" docker "github.com/fsouza/go-dockerclient" @@ -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"