internal: use atomic type (#27858)
This commit is contained in:
parent
60070fe5c6
commit
857476753d
@ -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...),
|
||||||
|
Loading…
Reference in New Issue
Block a user