(t testing.TB, field zap.Field)
| 63 | } |
| 64 | |
| 65 | func assertCanBeReused(t testing.TB, field zap.Field) { |
| 66 | var wg sync.WaitGroup |
| 67 | |
| 68 | for i := 0; i < 100; i++ { |
| 69 | enc := zapcore.NewMapObjectEncoder() |
| 70 | |
| 71 | // Ensure using the field in multiple encoders in separate goroutines |
| 72 | // does not cause any races or panics. |
| 73 | wg.Add(1) |
| 74 | go func() { |
| 75 | defer wg.Done() |
| 76 | assert.NotPanics(t, func() { |
| 77 | field.AddTo(enc) |
| 78 | }, "Reusing a field should not cause issues") |
| 79 | }() |
| 80 | } |
| 81 | |
| 82 | wg.Wait() |
| 83 | } |
no test coverage detected