(b *testing.B)
| 47 | } |
| 48 | |
| 49 | func BenchmarkCancelContextChannelNoErr(b *testing.B) { |
| 50 | ctx, cancel := context.WithCancel(context.Background()) |
| 51 | for i := 0; i < b.N; i++ { |
| 52 | select { |
| 53 | case <-ctx.Done(): |
| 54 | b.Fatal("error: ctx.Done():", ctx.Err()) |
| 55 | default: |
| 56 | } |
| 57 | } |
| 58 | cancel() |
| 59 | } |
| 60 | |
| 61 | func BenchmarkCancelContextChannelGotErr(b *testing.B) { |
| 62 | ctx, cancel := context.WithCancel(context.Background()) |