Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ezilber-akamai committed Nov 21, 2024
1 parent 5a29cac commit 755b7b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
Expand All @@ -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())
}
}

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 755b7b8

Please sign in to comment.