@@ -17,7 +17,7 @@ func checkGoroutinesLeak(onLeak func(stacks []string)) {
1717 time .Sleep (time .Millisecond )
1818
1919 if n := runtime .Stack (bb , false ); n < len (bb ) {
20- currentGoroutine = string (regexp .MustCompile (" ^goroutine \\ d+ " ).Find (bb [:n ]))
20+ currentGoroutine = string (regexp .MustCompile (` ^goroutine \d+ ` ).Find (bb [:n ]))
2121 }
2222
2323 if n := runtime .Stack (bb , true ); n < len (bb ) {
@@ -33,7 +33,11 @@ func checkGoroutinesLeak(onLeak func(stacks []string)) {
3333 }
3434 stack := strings .Split (g , "\n " )
3535 firstFunction := stack [1 ]
36- state := strings .Trim (regexp .MustCompile ("\\ [.*\\ ]" ).FindString (regexp .MustCompile ("^goroutine \\ d+ \\ [.*\\ ]" ).FindString (stack [0 ])), "[]" )
36+ state := strings .Trim (
37+ regexp .MustCompile (`\[.*\]` ).FindString (
38+ regexp .MustCompile (`^goroutine \d+ \[.*\]` ).FindString (stack [0 ]),
39+ ), "[]" ,
40+ )
3741 switch {
3842 case strings .HasPrefix (firstFunction , "testing.RunTests" ),
3943 strings .HasPrefix (firstFunction , "testing.(*T).Run" ),
@@ -52,11 +56,6 @@ func checkGoroutinesLeak(onLeak func(stacks []string)) {
5256 if strings .Contains (g , "runtime.ensureSigM" ) {
5357 continue
5458 }
55-
56- //case strings.HasPrefix(firstFunction, "syscall.syscall"):
57- // if strings.Contains(state, "syscall") {
58- // continue
59- // }
6059 }
6160
6261 unexpectedGoroutines = append (unexpectedGoroutines , g )
0 commit comments