()
| 371 | } |
| 372 | |
| 373 | func (sw *syncWriter) Bytes() []byte { |
| 374 | sw.mu.Lock() |
| 375 | defer sw.mu.Unlock() |
| 376 | // Return a copy to prevent race conditions with the underlying buffer |
| 377 | b := sw.w.Bytes() |
| 378 | result := make([]byte, len(b)) |
| 379 | copy(result, b) |
| 380 | return result |
| 381 | } |