Skip to content

Commit 8574767

Browse files
authored
internal: use atomic type (#27858)
1 parent 60070fe commit 8574767

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/cmdtest/test_cmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ type TestCmd struct {
5555
Err error
5656
}
5757

58-
var id int32
58+
var id atomic.Int32
5959

6060
// Run exec's the current binary using name as argv[0] which will trigger the
6161
// reexec init function for that name (e.g. "geth-test" in cmd/geth/run_test.go)
6262
func (tt *TestCmd) Run(name string, args ...string) {
63-
id := atomic.AddInt32(&id, 1)
64-
tt.stderr = &testlogger{t: tt.T, name: fmt.Sprintf("%d", id)}
63+
id.Add(1)
64+
tt.stderr = &testlogger{t: tt.T, name: fmt.Sprintf("%d", id.Load())}
6565
tt.cmd = &exec.Cmd{
6666
Path: reexec.Self(),
6767
Args: append([]string{name}, args...),

0 commit comments

Comments
 (0)