File tree Expand file tree Collapse file tree 2 files changed +19
-19
lines changed
Expand file tree Collapse file tree 2 files changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -13,36 +13,36 @@ var aCtx = &aContext{
1313}
1414
1515type aContext struct {
16- mu sync.RWMutex
17- failNowStates map [int64 ]bool // [goroutineID]bool
16+ mu sync.RWMutex
17+ failNowStates map [int64 ]bool // [goroutineID]bool
1818}
1919
2020func (ac * aContext ) failNowOn () {
21- ac .mu .Lock ()
22- defer ac .mu .Unlock ()
23- ac .failNowStates [goroutineID ()] = true
21+ ac .mu .Lock ()
22+ defer ac .mu .Unlock ()
23+ ac .failNowStates [goroutineID ()] = true
2424}
2525
2626func (ac * aContext ) failNotNow () {
27- ac .mu .Lock ()
28- defer ac .mu .Unlock ()
29- delete (ac .failNowStates , goroutineID ())
27+ ac .mu .Lock ()
28+ defer ac .mu .Unlock ()
29+ delete (ac .failNowStates , goroutineID ())
3030}
3131
3232func (ac * aContext ) failNowState () bool {
33- ac .mu .RLock ()
34- defer ac .mu .RUnlock ()
35- return ac .failNowStates [goroutineID ()]
33+ ac .mu .RLock ()
34+ defer ac .mu .RUnlock ()
35+ return ac .failNowStates [goroutineID ()]
3636}
3737
3838func goroutineID () int64 {
39- var buf [64 ]byte
40- n := runtime .Stack (buf [:], false )
41- idField := strings .Fields (strings .TrimPrefix (string (buf [:n ]), "goroutine " ))[0 ]
42- id , err := strconv .ParseInt (idField , 10 , 64 )
39+ var buf [64 ]byte
40+ n := runtime .Stack (buf [:], false )
41+ idField := strings .Fields (strings .TrimPrefix (string (buf [:n ]), "goroutine " ))[0 ]
42+ id , err := strconv .ParseInt (idField , 10 , 64 )
4343 if err != nil {
4444 panic (err )
4545 }
4646
47- return id
47+ return id
4848}
Original file line number Diff line number Diff line change @@ -36,9 +36,9 @@ func (a *testingA) FailNow() *testingA {
3636 })
3737*/
3838func FailNow (fn func ()) {
39- aCtx .failNowOn ()
40- defer aCtx .failNotNow ()
41- fn ()
39+ aCtx .failNowOn ()
40+ defer aCtx .failNotNow ()
41+ fn ()
4242}
4343
4444// X turns on a flag to show test values as raw in a fail report.
You can’t perform that action at this time.
0 commit comments