(b *testing.B)
| 37 | } |
| 38 | |
| 39 | func BenchmarkCancelContextErrGotErr(b *testing.B) { |
| 40 | ctx, cancel := context.WithCancel(context.Background()) |
| 41 | cancel() |
| 42 | for i := 0; i < b.N; i++ { |
| 43 | if err := ctx.Err(); err == nil { |
| 44 | b.Fatal("error") |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func BenchmarkCancelContextChannelNoErr(b *testing.B) { |
| 50 | ctx, cancel := context.WithCancel(context.Background()) |