写入文件
(filepath, content string)
| 26 | |
| 27 | //写入文件 |
| 28 | func writeStringToFile(filepath, content string) { |
| 29 | //打开文件,没有则创建,有则append内容 |
| 30 | w1, error := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) |
| 31 | checkError(error) |
| 32 | |
| 33 | _, err1 := w1.Write([]byte(content + "\n")) |
| 34 | checkError(err1) |
| 35 | |
| 36 | errC := w1.Close() |
| 37 | checkError(errC) |
| 38 | } |
| 39 | |
| 40 | //写入文件 |
| 41 | func writeBytesToFile(filepath string, content []byte) { |
nothing calls this directly
no test coverage detected