diff --git a/pkg/skaffold/kubernetes/portforward/entry_manager_test.go b/pkg/skaffold/kubernetes/portforward/entry_manager_test.go index 0a0da9c16a7..1f2ba7e0b7e 100644 --- a/pkg/skaffold/kubernetes/portforward/entry_manager_test.go +++ b/pkg/skaffold/kubernetes/portforward/entry_manager_test.go @@ -48,13 +48,13 @@ func TestNewEntryManager(t *testing.T) { } func TestStop(t *testing.T) { - pfe1 := NewPortForwardEntry(0, latest.PortForwardResource{ + pfe1 := newPortForwardEntry(0, latest.PortForwardResource{ Type: constants.Pod, Name: "resource", Namespace: "default", }, "", "", "", 9000, false) - pfe2 := NewPortForwardEntry(0, latest.PortForwardResource{ + pfe2 := newPortForwardEntry(0, latest.PortForwardResource{ Type: constants.Pod, Name: "resource2", Namespace: "default", diff --git a/pkg/skaffold/kubernetes/portforward/pod_forwarder.go b/pkg/skaffold/kubernetes/portforward/pod_forwarder.go index 39aa2dc95c1..159a2bf9f57 100644 --- a/pkg/skaffold/kubernetes/portforward/pod_forwarder.go +++ b/pkg/skaffold/kubernetes/portforward/pod_forwarder.go @@ -137,7 +137,7 @@ func (p *WatchingPodForwarder) podForwardingEntry(resourceVersion, containerName if err != nil { return nil, errors.Wrap(err, "converting resource version to integer") } - entry := NewPortForwardEntry(rv, resource, resource.Name, containerName, portName, 0, true) + entry := newPortForwardEntry(rv, resource, resource.Name, containerName, portName, 0, true) // If we have, return the current entry oldEntry, ok := p.forwardedResources.Load(entry.key()) diff --git a/pkg/skaffold/kubernetes/portforward/port_forward_entry.go b/pkg/skaffold/kubernetes/portforward/port_forward_entry.go index ddeef352821..bf2439ba6c4 100644 --- a/pkg/skaffold/kubernetes/portforward/port_forward_entry.go +++ b/pkg/skaffold/kubernetes/portforward/port_forward_entry.go @@ -37,8 +37,8 @@ type portForwardEntry struct { cancel context.CancelFunc } -// NewPortForwardEntry returns a port forward entry. -func NewPortForwardEntry(resourceVersion int, resource latest.PortForwardResource, podName, containerName, portName string, localPort int, automaticPodForwarding bool) *portForwardEntry { +// newPortForwardEntry returns a port forward entry. +func newPortForwardEntry(resourceVersion int, resource latest.PortForwardResource, podName, containerName, portName string, localPort int, automaticPodForwarding bool) *portForwardEntry { return &portForwardEntry{ resourceVersion: resourceVersion, resource: resource, diff --git a/pkg/skaffold/kubernetes/portforward/port_forward_entry_test.go b/pkg/skaffold/kubernetes/portforward/port_forward_entry_test.go index b350fd43b9e..0e730bff31a 100644 --- a/pkg/skaffold/kubernetes/portforward/port_forward_entry_test.go +++ b/pkg/skaffold/kubernetes/portforward/port_forward_entry_test.go @@ -32,7 +32,7 @@ func TestPortForwardEntryKey(t *testing.T) { }{ { description: "entry for pod", - pfe: NewPortForwardEntry(0, latest.PortForwardResource{ + pfe: newPortForwardEntry(0, latest.PortForwardResource{ Type: "pod", Name: "podName", Namespace: "default", @@ -41,7 +41,7 @@ func TestPortForwardEntryKey(t *testing.T) { expected: "pod-podName-default-8080", }, { description: "entry for deploy", - pfe: NewPortForwardEntry(0, latest.PortForwardResource{ + pfe: newPortForwardEntry(0, latest.PortForwardResource{ Type: "deployment", Name: "depName", Namespace: "namespace", @@ -74,7 +74,7 @@ func TestAutomaticPodForwardingKey(t *testing.T) { }{ { description: "entry for automatically port forwarded pod", - pfe: NewPortForwardEntry(0, latest.PortForwardResource{ + pfe: newPortForwardEntry(0, latest.PortForwardResource{ Type: "pod", Name: "podName", Namespace: "default", diff --git a/pkg/skaffold/kubernetes/portforward/port_forward_integration.go b/pkg/skaffold/kubernetes/portforward/port_forward_integration.go index 90831666512..fb6d885b183 100644 --- a/pkg/skaffold/kubernetes/portforward/port_forward_integration.go +++ b/pkg/skaffold/kubernetes/portforward/port_forward_integration.go @@ -37,7 +37,7 @@ func WhiteBoxPortForwardCycle(t *testing.T, kubectlCLI *kubectl.CLI, namespace s portForwardEvent = func(entry *portForwardEntry) {} ctx := context.Background() localPort := retrieveAvailablePort(9000, em.forwardedPorts) - pfe := NewPortForwardEntry(0, latest.PortForwardResource{ + pfe := newPortForwardEntry(0, latest.PortForwardResource{ Type: "deployment", Name: "leeroy-web", Namespace: namespace, diff --git a/pkg/skaffold/kubernetes/portforward/resource_forwarder.go b/pkg/skaffold/kubernetes/portforward/resource_forwarder.go index 5e32c46ab0a..6bc26f83179 100644 --- a/pkg/skaffold/kubernetes/portforward/resource_forwarder.go +++ b/pkg/skaffold/kubernetes/portforward/resource_forwarder.go @@ -80,7 +80,7 @@ func (p *ResourceForwarder) portForwardResource(ctx context.Context, resource la func (p *ResourceForwarder) getCurrentEntry(resource latest.PortForwardResource) *portForwardEntry { // determine if we have seen this before - entry := NewPortForwardEntry(0, resource, "", "", "", 0, false) + entry := newPortForwardEntry(0, resource, "", "", "", 0, false) // If we have, return the current entry oldEntry, ok := p.forwardedResources.Load(entry.key()) diff --git a/pkg/skaffold/kubernetes/portforward/resource_forwarder_test.go b/pkg/skaffold/kubernetes/portforward/resource_forwarder_test.go index be1b6a8598b..bc7f1e6b72e 100644 --- a/pkg/skaffold/kubernetes/portforward/resource_forwarder_test.go +++ b/pkg/skaffold/kubernetes/portforward/resource_forwarder_test.go @@ -154,7 +154,7 @@ func TestGetCurrentEntryFunc(t *testing.T) { Port: 8080, }, availablePorts: []int{8080}, - expected: NewPortForwardEntry(0, latest.PortForwardResource{}, "", "", "", 8080, false), + expected: newPortForwardEntry(0, latest.PortForwardResource{}, "", "", "", 8080, false), }, { description: "port forward existing deployment", resource: latest.PortForwardResource{ @@ -174,7 +174,7 @@ func TestGetCurrentEntryFunc(t *testing.T) { localPort: 9000, }, }, - expected: NewPortForwardEntry(0, latest.PortForwardResource{}, "", "", "", 9000, false), + expected: newPortForwardEntry(0, latest.PortForwardResource{}, "", "", "", 9000, false), }, }