CreateFile creates a file on given path with given content
(filePath string, content string)
| 32 | |
| 33 | // CreateFile creates a file on given path with given content |
| 34 | func CreateFile(filePath string, content string) error { |
| 35 | f, err := os.Create(filePath) |
| 36 | if err != nil { |
| 37 | return err |
| 38 | } |
| 39 | |
| 40 | defer func() { _ = f.Close() }() |
| 41 | |
| 42 | _, err = f.WriteString(content) |
| 43 | |
| 44 | if err != nil { |
| 45 | return err |
| 46 | } |
| 47 | return nil |
| 48 | } |