fileExists reports whether fname exists and is a regular file.
(fname string)
| 309 | |
| 310 | // fileExists reports whether fname exists and is a regular file. |
| 311 | func fileExists(fname string) bool { |
| 312 | info, err := os.Stat(fname) |
| 313 | if os.IsNotExist(err) { |
| 314 | return false |
| 315 | } |
| 316 | return !info.IsDir() |
| 317 | } |
| 318 | |
| 319 | // closeFiles closes a list of files and returns the first error (if any). |
| 320 | func closeFiles(fs ...*os.File) (cerr error) { |