Documentation
¶
Overview ¶
check-retry checks that variables modified inside retry callbacks are properly reset at the beginning of the callback body.
When a function like WithRetry or ReadWriteTransaction retries the callback, variables from the outer scope retain values from previous attempts. This can cause inflated counters, duplicate entries, or stale results.
Usage ¶
check-retry ./...
Bad ¶
rows := []int{}
WithRetry(func() {
rows = append(rows, 123)
})
Good ¶
var rows []int
WithRetry(func() {
rows = []int{}
rows = append(rows, 123)
})
Click to show internal directories.
Click to hide internal directories.