Skip to content

Commit

Permalink
Merge pull request #414 from hashicorp/aw/linting
Browse files Browse the repository at this point in the history
Fix linting errors
  • Loading branch information
annawinkler committed Jun 3, 2022
2 parents ac3d417 + ec530b4 commit 88e12c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions helper_test.go
Expand Up @@ -1302,18 +1302,19 @@ 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 {
defer tick.Stop()

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

if retries >= maxRetries {
Expand Down
4 changes: 2 additions & 2 deletions tfe.go
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 88e12c3

Please sign in to comment.