R006¶
ResourcesStandard
check for RetryFunc that omit retryable errors
The R006 analyzer reports when RetryFunc declarations are missing retryable errors (e.g. RetryableError() calls) and should not be used as RetryFunc.
Options¶
Namespaced under the check ID on the command line, as -R006.package-aliases=VALUE.
| Flag | Default | Effect |
|---|---|---|
package-aliases |
none | Comma-separated list of additional Go import paths to treat as aliases for helper/resource |
Examples¶
_, err := conn.DoSomething(input)
if err != nil {
return err
}
// or
err := resource.Retry(1 * time.Minute, func() *RetryError {
// Calling API logic, e.g.
_, err := conn.DoSomething(input)
if /* check err for retryable condition */ {
return resource.RetryableError(err)
}
if err != nil {
return resource.NonRetryableError(err)
}
return nil
})
Ignoring reports¶
Singular reports can be ignored by adding a //lintignore:R006 Go code comment at the end of the offending line or on the line immediately preceding, e.g.
//lintignore:R006
err := resource.Retry(1 * time.Minute, func() *RetryError {
// Calling API logic, e.g.
_, err := conn.DoSomething(input)
if err != nil {
return resource.NonRetryableError(err)
}
return nil
})
This page is generated from passes/R006/README.md, which lives beside the analyzer.