Unverified Commit 85747675 authored by ucwong's avatar ucwong Committed by GitHub

internal: use atomic type (#27858)

parent 60070fe5
...@@ -55,13 +55,13 @@ type TestCmd struct { ...@@ -55,13 +55,13 @@ type TestCmd struct {
Err error Err error
} }
var id int32 var id atomic.Int32
// Run exec's the current binary using name as argv[0] which will trigger the // Run exec's the current binary using name as argv[0] which will trigger the
// reexec init function for that name (e.g. "geth-test" in cmd/geth/run_test.go) // reexec init function for that name (e.g. "geth-test" in cmd/geth/run_test.go)
func (tt *TestCmd) Run(name string, args ...string) { func (tt *TestCmd) Run(name string, args ...string) {
id := atomic.AddInt32(&id, 1) id.Add(1)
tt.stderr = &testlogger{t: tt.T, name: fmt.Sprintf("%d", id)} tt.stderr = &testlogger{t: tt.T, name: fmt.Sprintf("%d", id.Load())}
tt.cmd = &exec.Cmd{ tt.cmd = &exec.Cmd{
Path: reexec.Self(), Path: reexec.Self(),
Args: append([]string{name}, args...), Args: append([]string{name}, args...),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment