From a95974cf791c9ced09c322f4bbc2c0ac943a652c Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 23 Mar 2020 13:27:59 -0400 Subject: [PATCH] Remove unnecessary methods They call only a single method and add no additional functionality --- command/connect/envoy/envoy.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/command/connect/envoy/envoy.go b/command/connect/envoy/envoy.go index a62f80fe0f..000fa713f1 100644 --- a/command/connect/envoy/envoy.go +++ b/command/connect/envoy/envoy.go @@ -208,7 +208,6 @@ func canBindInternal(addr string, ifAddrs []net.Addr) bool { func canBind(addr string) bool { ifAddrs, err := net.InterfaceAddrs() - if err != nil { return false } @@ -344,14 +343,14 @@ func (c *cmd) Run(args []string) int { // See if we need to lookup proxyID if c.proxyID == "" && c.sidecarFor != "" { - proxyID, err := c.lookupProxyIDForSidecar() + proxyID, err := proxyCmd.LookupProxyIDForSidecar(c.client, c.sidecarFor) if err != nil { c.UI.Error(err.Error()) return 1 } c.proxyID = proxyID } else if c.proxyID == "" && c.meshGateway { - gatewaySvc, err := c.lookupGatewayProxy() + gatewaySvc, err := proxyCmd.LookupGatewayProxy(c.client) if err != nil { c.UI.Error(err.Error()) return 1 @@ -361,8 +360,7 @@ func (c *cmd) Run(args []string) int { } if c.proxyID == "" { - c.UI.Error("No proxy ID specified. One of -proxy-id or -sidecar-for/-mesh-gateway is " + - "required") + c.UI.Error("No proxy ID specified. One of -proxy-id or -sidecar-for/-mesh-gateway is required") return 1 } @@ -572,14 +570,6 @@ func (c *cmd) generateConfig() ([]byte, error) { return bsCfg.GenerateJSON(args) } -func (c *cmd) lookupProxyIDForSidecar() (string, error) { - return proxyCmd.LookupProxyIDForSidecar(c.client, c.sidecarFor) -} - -func (c *cmd) lookupGatewayProxy() (*api.AgentService, error) { - return proxyCmd.LookupGatewayProxy(c.client) -} - func (c *cmd) lookupGRPCPort() (int, error) { self, err := c.client.Agent().Self() if err != nil {