func FileWriter(path string, perm os.FileMode) *os.File {
	if path == "" {
		return nil
	}

	var err error
	var file *os.File
	if _, err = os.Stat(path); err != nil {
		if _, err = os.Stat(filepath.Dir(path)); err != nil {
			err = os.MkdirAll(filepath.Dir(path), perm)
			if err != nil {
				return nil
			}
		}
		file, err = os.Create(path)
		if err != nil {
			return nil
		}

		err = file.Close()
		if err != nil {
			return nil
		}
	}

	file, err = os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, perm)

	if err != nil {
		return nil
	}

	return file
}
func FileWriter(path string, perm os.FileMode) *os.File {
	if path == "" {
		return nil
	}

	var err error
	var file *os.File
	if _, err = os.Stat(path); err != nil {
		if _, err = os.Stat(filepath.Dir(path)); err != nil {
			err = os.MkdirAll(filepath.Dir(path), perm)
			if err != nil {
				return nil
			}
		}
		file, err = os.Create(path)
		if err != nil {
			return nil
		}

		err = file.Close()
		if err != nil {
			return nil
		}
	}

	file, err = os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, perm)

	if err != nil {
		return nil
	}

	return file
}
func FileWriter ( path string , perm os . FileMode ) * os . File { if path == " " { return nil } var err error var file * os . File if _ , err = os . Stat ( path ) ; err != nil { if _ , err = os . Stat ( filepath . Dir ( path ) ) ; err != nil { err = os . MkdirAll ( filepath . Dir ( path ) , perm ) if err != nil { return nil } } file , err = os . Create ( path ) if err != nil { return nil } err = file . Close ( ) if err != nil { return nil } } file , err = os . OpenFile ( path , os . O_APPEND | os . O_CREATE | os . O_WRONLY , perm ) if err != nil { return nil } return file }
// FileWriter generates *osFile -> io.Writer
FileWriter generates * osFile - > io . Writer