No description
Find a file
oss-core-libraries-dashboard[bot] 0037ff9513
[COMPLIANCE] Update Copyright and License Headers (#6)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2026-02-20 15:28:18 +05:30
.gitignore Initial commit 2019-07-15 17:35:02 -06:00
go.mod fix errant file skipping (#4) 2023-06-07 16:16:47 -05:00
go.sum go mod tidy 2019-07-15 19:16:20 -06:00
LICENSE [COMPLIANCE] Update Copyright and License Headers (#6) 2026-02-20 15:28:18 +05:30
lint-consul-retry.go [COMPLIANCE] Update Copyright and License Headers (#6) 2026-02-20 15:28:18 +05:30
README.md Update README.md 2019-07-16 12:03:17 -06:00

lint-consul-retry

Checks if function literal in consul/sdk/testutil/retry.Run uses t *testing.T.

retry.Run needs to operate on retry.R rather than testing.T, else the function will not retry on errors.

Examples:

Bad:

require := require.New(t)

retry.Run(t, func(r *retry.R) {
  require.NotNil(err)
}
retry.Run(t, func(r *retry.R) {
  assert.NotNil(t, err)
}
retry.Run(t, func(r *retry.R) {
  if err := myFunc(); err != nil {
    t.Fatalf("failing")
   }
}

OK:

retry.Run(t, func(r *retry.R) {
  require.NotNil(r, err)
}
retry.Run(t, func(t *retry.R) {
  assert.NotNil(t, err)
}
retry.Run(t, func(r *retry.R) {
  if err := myFunc(); err != nil {
    r.Fatalf("failing")
   }
}

Usage:

Run ./lint-consul-retry from the base directory of Consul.