lint-consul-retry

command module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL