@@ -30,7 +30,7 @@ func TestPanicErrorUnwrap(t *testing.T) {
3030
3131 testCases := []struct {
3232 name string
33- panicValue interface {}
33+ panicValue any
3434 wrappedErrorType bool
3535 }{
3636 {
@@ -51,7 +51,7 @@ func TestPanicErrorUnwrap(t *testing.T) {
5151 t .Run (tc .name , func (t * testing.T ) {
5252 t .Parallel ()
5353
54- var recovered interface {}
54+ var recovered any
5555
5656 group := & Group {}
5757
@@ -61,7 +61,7 @@ func TestPanicErrorUnwrap(t *testing.T) {
6161 t .Logf ("after panic(%#v) in group.Do, recovered %#v" , tc .panicValue , recovered )
6262 }()
6363
64- _ , _ , _ = group .Do (tc .name , func () (interface {} , error ) {
64+ _ , _ , _ = group .Do (tc .name , func () (any , error ) {
6565 panic (tc .panicValue )
6666 })
6767 }()
@@ -84,7 +84,7 @@ func TestPanicErrorUnwrap(t *testing.T) {
8484
8585func TestDo (t * testing.T ) {
8686 var g Group
87- v , err , _ := g .Do ("key" , func () (interface {} , error ) {
87+ v , err , _ := g .Do ("key" , func () (any , error ) {
8888 return "bar" , nil
8989 })
9090 if got , want := fmt .Sprintf ("%v (%T)" , v , v ), "bar (string)" ; got != want {
@@ -98,7 +98,7 @@ func TestDo(t *testing.T) {
9898func TestDoErr (t * testing.T ) {
9999 var g Group
100100 someErr := errors .New ("Some error" )
101- v , err , _ := g .Do ("key" , func () (interface {} , error ) {
101+ v , err , _ := g .Do ("key" , func () (any , error ) {
102102 return nil , someErr
103103 })
104104 if err != someErr {
@@ -114,7 +114,7 @@ func TestDoDupSuppress(t *testing.T) {
114114 var wg1 , wg2 sync.WaitGroup
115115 c := make (chan string , 1 )
116116 var calls int32
117- fn := func () (interface {} , error ) {
117+ fn := func () (any , error ) {
118118 if atomic .AddInt32 (& calls , 1 ) == 1 {
119119 // First invocation.
120120 wg1 .Done ()
@@ -167,7 +167,7 @@ func TestForget(t *testing.T) {
167167 )
168168
169169 go func () {
170- g .Do ("key" , func () (i interface {} , e error ) {
170+ g .Do ("key" , func () (i any , e error ) {
171171 close (firstStarted )
172172 <- unblockFirst
173173 close (firstFinished )
@@ -178,15 +178,15 @@ func TestForget(t *testing.T) {
178178 g .Forget ("key" )
179179
180180 unblockSecond := make (chan struct {})
181- secondResult := g .DoChan ("key" , func () (i interface {} , e error ) {
181+ secondResult := g .DoChan ("key" , func () (i any , e error ) {
182182 <- unblockSecond
183183 return 2 , nil
184184 })
185185
186186 close (unblockFirst )
187187 <- firstFinished
188188
189- thirdResult := g .DoChan ("key" , func () (i interface {} , e error ) {
189+ thirdResult := g .DoChan ("key" , func () (i any , e error ) {
190190 return 3 , nil
191191 })
192192
@@ -200,7 +200,7 @@ func TestForget(t *testing.T) {
200200
201201func TestDoChan (t * testing.T ) {
202202 var g Group
203- ch := g .DoChan ("key" , func () (interface {} , error ) {
203+ ch := g .DoChan ("key" , func () (any , error ) {
204204 return "bar" , nil
205205 })
206206
@@ -219,7 +219,7 @@ func TestDoChan(t *testing.T) {
219219// See https://github.com/golang/go/issues/41133
220220func TestPanicDo (t * testing.T ) {
221221 var g Group
222- fn := func () (interface {} , error ) {
222+ fn := func () (any , error ) {
223223 panic ("invalid memory address or nil pointer dereference" )
224224 }
225225
@@ -256,7 +256,7 @@ func TestPanicDo(t *testing.T) {
256256
257257func TestGoexitDo (t * testing.T ) {
258258 var g Group
259- fn := func () (interface {} , error ) {
259+ fn := func () (any , error ) {
260260 runtime .Goexit ()
261261 return nil , nil
262262 }
@@ -310,7 +310,7 @@ func TestPanicDoChan(t *testing.T) {
310310 }()
311311
312312 g := new (Group )
313- ch := g .DoChan ("" , func () (interface {} , error ) {
313+ ch := g .DoChan ("" , func () (any , error ) {
314314 panic ("Panicking in DoChan" )
315315 })
316316 <- ch
@@ -351,15 +351,15 @@ func TestPanicDoSharedByDoChan(t *testing.T) {
351351 defer func () {
352352 recover ()
353353 }()
354- g .Do ("" , func () (interface {} , error ) {
354+ g .Do ("" , func () (any , error ) {
355355 close (blocked )
356356 <- unblock
357357 panic ("Panicking in Do" )
358358 })
359359 }()
360360
361361 <- blocked
362- ch := g .DoChan ("" , func () (interface {} , error ) {
362+ ch := g .DoChan ("" , func () (any , error ) {
363363 panic ("DoChan unexpectedly executed callback" )
364364 })
365365 close (unblock )
@@ -395,11 +395,11 @@ func ExampleGroup() {
395395 g := new (Group )
396396
397397 block := make (chan struct {})
398- res1c := g .DoChan ("key" , func () (interface {} , error ) {
398+ res1c := g .DoChan ("key" , func () (any , error ) {
399399 <- block
400400 return "func 1" , nil
401401 })
402- res2c := g .DoChan ("key" , func () (interface {} , error ) {
402+ res2c := g .DoChan ("key" , func () (any , error ) {
403403 <- block
404404 return "func 2" , nil
405405 })
0 commit comments