check-retry

command
v0.0.0-...-d52e91e Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

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)
})

Jump to

Keyboard shortcuts

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