Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
annawinkler committed Jun 1, 2022
1 parent 80a18ff commit 31057b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
26 changes: 13 additions & 13 deletions helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,27 +1233,27 @@ func waitForRunLock(t *testing.T, client *Client, workspaceID string) {
wg.Wait()
}

func retry(f retryableFn) (interface{}, error) {
func retry(f retryableFn) (interface{}, error) { //nolint
tick := time.NewTicker(tickDuration * time.Second)

retries := 0
maxRetries := 5

for {
select {
case <-tick.C:
res, err := f()
if err == nil {
return res, err
}
defer tick.Stop()

if retries >= maxRetries {
return nil, err
}
for range tick.C {
res, err := f()
if err == nil {
return res, nil
}

retries += 1
if retries >= maxRetries {
return nil, err
}

retries += 1
}

return nil, nil
}

func genSha(t *testing.T, secret, data string) string {
Expand Down
4 changes: 2 additions & 2 deletions tfe.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ func checkResponseCode(r *http.Response) error {
return err
}

return fmt.Errorf(strings.Join(errs, "\n"))
return errors.New(strings.Join(errs, "\n"))
}

func decodeErrorPayload(r *http.Response) ([]string, error) {
Expand All @@ -863,7 +863,7 @@ func decodeErrorPayload(r *http.Response) ([]string, error) {
errPayload := &jsonapi.ErrorsPayload{}
err := json.NewDecoder(r.Body).Decode(errPayload)
if err != nil || len(errPayload.Errors) == 0 {
return errs, fmt.Errorf(r.Status)
return errs, errors.New(r.Status)
}

// Parse and format the errors.
Expand Down

0 comments on commit 31057b7

Please sign in to comment.