(name, content string)
| 1177 | var EXAMPLE_CONTACTS string |
| 1178 | |
| 1179 | func createIfNotExist(name, content string) (bool, error) { |
| 1180 | _, err := os.Stat(name) |
| 1181 | if err != nil { |
| 1182 | // if the file doesn't exist, create it |
| 1183 | if errors.Is(err, fs.ErrNotExist) { |
| 1184 | err = os.WriteFile(name, []byte(content), 0777) |
| 1185 | if err != nil { |
| 1186 | return false, err |
| 1187 | } |
| 1188 | // created file successfully |
| 1189 | return true, nil |
| 1190 | } else { |
| 1191 | return false, err |
| 1192 | } |
| 1193 | } |
| 1194 | return false, nil |
| 1195 | } |
| 1196 | |
| 1197 | func copyFile(src, dst string) { |
| 1198 | reader, err := os.Open(src) |
no outgoing calls
no test coverage detected