From 755b7b865836ba1955f44c667df0e9e2bd464496 Mon Sep 17 00:00:00 2001 From: ezilber-akamai Date: Thu, 21 Nov 2024 15:11:04 -0500 Subject: [PATCH] Fix lint --- client.go | 12 ++++++------ errors.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client.go b/client.go index 3a7335161..2584a013d 100644 --- a/client.go +++ b/client.go @@ -174,8 +174,8 @@ func (c *Client) doRequest(ctx context.Context, method, endpoint string, params for range c.retryCount { // Reset the body to the start for each retry if it's not nil if params.Body != nil { - _, err := params.Body.Seek(0, io.SeekStart) - if err != nil { + _, seekErr := params.Body.Seek(0, io.SeekStart) + if seekErr != nil { return c.ErrorAndLogf("failed to seek to the start of the body: %v", err.Error()) } } @@ -186,8 +186,8 @@ func (c *Client) doRequest(ctx context.Context, method, endpoint string, params } if paginationMutator != nil { - if err := (*paginationMutator)(req); err != nil { - return c.ErrorAndLogf("failed to mutate before request: %v", err.Error()) + if mutatorErr := (*paginationMutator)(req); mutatorErr != nil { + return c.ErrorAndLogf("failed to mutate before request: %v", mutatorErr.Error()) } } @@ -934,8 +934,8 @@ func NewClientFromEnv(hc *http.Client) (*Client, error) { client.selectedProfile = configProfile // We should only load the config if the config file exists - if _, err := os.Stat(configPath); err != nil { - return nil, fmt.Errorf("error loading config file %s: %w", configPath, err) + if _, statErr := os.Stat(configPath); statErr != nil { + return nil, fmt.Errorf("error loading config file %s: %w", configPath, statErr) } err = client.preLoadConfig(configPath) diff --git a/errors.go b/errors.go index 40b1852d9..219ab9755 100644 --- a/errors.go +++ b/errors.go @@ -76,9 +76,9 @@ func coupleAPIErrors(resp *http.Response, err error) (*http.Response, error) { return nil, NewError(fmt.Errorf("response body is nil")) } - bodyBytes, err := io.ReadAll(resp.Body) - if err != nil { - return nil, NewError(fmt.Errorf("failed to read response body: %w", err)) + bodyBytes, readErr := io.ReadAll(resp.Body) + if readErr != nil { + return nil, NewError(fmt.Errorf("failed to read response body: %w", readErr)) } resp.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))