写入文件
(filepath string, content []byte)
| 39 | |
| 40 | //写入文件 |
| 41 | func writeBytesToFile(filepath string, content []byte) { |
| 42 | //打开文件,没有此文件则创建文件,将写入的内容append进去 |
| 43 | w1, error := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644) |
| 44 | checkError(error) |
| 45 | |
| 46 | _, err1 := w1.Write(content) |
| 47 | checkError(err1) |
| 48 | |
| 49 | errC := w1.Close() |
| 50 | checkError(errC) |
| 51 | } |
| 52 | |
| 53 | func checkError(err error) { |
| 54 | if err != nil { |
nothing calls this directly
no test coverage detected