package filesystem import ( "errors" "os" ) // Exists returns true if there was no error checking the file existence. func Exists(name string) (bool, error) { if _, err := os.Stat(name); errors.Is(err, os.ErrNotExist) { return false, nil } else if err != nil { return false, err } return true, nil }