1 package filesystem 2 3 import ( 4 "errors" 5 "os" 6 ) 7 8 // Exists returns true if there was no error checking the file existence. 9 func Exists(name string) (bool, error) { 10 if _, err := os.Stat(name); errors.Is(err, os.ErrNotExist) { 11 return false, nil 12 } else if err != nil { 13 return false, err 14 } 15 return true, nil 16 } 17