WriteString implements io.StringWriter. It check whether writer has written something and init a file at first time
(str string)
| 530 | |
| 531 | // WriteString implements io.StringWriter. It check whether writer has written something and init a file at first time |
| 532 | func (l *LazyStringWriter) WriteString(str string) (int, error) { |
| 533 | l.Do(func() { l.err = l.initRoutine() }) |
| 534 | if l.err != nil { |
| 535 | return 0, errors.Errorf("open file error: %s", l.err.Error()) |
| 536 | } |
| 537 | return l.StringWriter.WriteString(str) |
| 538 | } |
| 539 | |
| 540 | type writerError struct { |
| 541 | error |
no test coverage detected