prependToEmptyFile prepends the specified text to an empty file. If the file is not empty this method does nothing.
(path, text string)
| 519 | // |
| 520 | // If the file is not empty this method does nothing. |
| 521 | func prependToEmptyFile(path, text string) error { |
| 522 | info, err := os.Stat(path) |
| 523 | |
| 524 | if err == nil && info.Size() == 0 { |
| 525 | return os.WriteFile(path, []byte(text), 0644) |
| 526 | } |
| 527 | |
| 528 | return err |
| 529 | } |
| 530 | |
| 531 | // filesContent returns a map with all direct files within the specified dir and their content. |
| 532 | // |
no test coverage detected
searching dependent graphs…