From f6edfc3289c2dfea3d405fc77a995d5a9522e68c Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Thu, 28 Jun 2018 13:02:05 -0500 Subject: [PATCH] lfsapi/client.go: make sshResolveWithRetries return a pointer --- lfsapi/client.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lfsapi/client.go b/lfsapi/client.go index 80511200..1b737511 100644 --- a/lfsapi/client.go +++ b/lfsapi/client.go @@ -23,12 +23,11 @@ import ( const MediaType = "application/vnd.git-lfs+json; charset=utf-8" var ( - UserAgent = "git-lfs" - httpRE = regexp.MustCompile(`\Ahttps?://`) - maxSshAuthenticateRetries = 5 + UserAgent = "git-lfs" + httpRE = regexp.MustCompile(`\Ahttps?://`) ) -func (c *Client) sshResolveWithRetries(e Endpoint, method string) (sshAuthResponse, error) { +func (c *Client) sshResolveWithRetries(e Endpoint, method string) (*sshAuthResponse, error) { var sshRes sshAuthResponse var err error @@ -36,7 +35,7 @@ func (c *Client) sshResolveWithRetries(e Endpoint, method string) (sshAuthRespon for i := 0; i < requests; i++ { sshRes, err = c.SSH.Resolve(e, method) if err == nil { - return sshRes, nil + return &sshRes, nil } tracerx.Printf("ssh: %s failed, error: %s, message: %s", @@ -45,10 +44,9 @@ func (c *Client) sshResolveWithRetries(e Endpoint, method string) (sshAuthRespon } if len(sshRes.Message) > 0 { - return sshAuthResponse{}, errors.Wrap(err, sshRes.Message) + return nil, errors.Wrap(err, sshRes.Message) } - - return sshAuthResponse{}, err + return nil, err } func (c *Client) NewRequest(method string, e Endpoint, suffix string, body interface{}) (*http.Request, error) {