Documentation
¶
Index ¶
- func FileCopy(fs afero.Fs, sourcePath string, destPath string) error
- func FileCopyRecursively(fs afero.Fs, sourcePath string, destPath string) error
- func FileListRecursively(fs afero.Fs, path string) ([]string, error)
- func FileListRecursivelyWithoutDirs(fs afero.Fs, path string) ([]string, error)
- func FindString(slice []string, val string) (int, bool)
- func HTTPDownloadFile(fs afero.Fs, file afero.File, url string) error
- func NewDirectoryWithKeep(fs afero.Fs, path string) error
- func NewFileIfNotExist(fs afero.Fs, path string) error
- func NewFileWithContentIfNotExist(fs afero.Fs, path string, content string) error
- func RemoveDuplicatedStrings(slice []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileCopyRecursively ¶
FileCopyRecursively copies recursively files from one directory to other, being similar to a `cp -R` command. Based on walk function https://github.com/spf13/afero/blob/master/path.go
func FileListRecursively ¶
FileListRecursively list recursively all files inside a directory. The result list is alphanumerically ordered
func FileListRecursivelyWithoutDirs ¶
FileListRecursivelyWithoutDirs list recursively all files inside a directory, excluding directories. The result list is alphanumerically ordered
func FindString ¶
FindString takes a slice and looks for a string in it. If found it will return it's key, otherwise it will return nil and a bool of false.
func HTTPDownloadFile ¶
HTTPDownloadFile downloads a url and store it in local filepath. Based on https://progolang.com/how-to-download-files-in-go/
func NewDirectoryWithKeep ¶
NewDirectoryWithKeep creates a directory and an empty .keep file to maintain filetree in git
func NewFileIfNotExist ¶
NewFileIfNotExist creates a empty file if is not present, or do nothing if file already exists
func NewFileWithContentIfNotExist ¶
NewFileWithContentIfNotExist creates a file with a speficied content only if file doesn't exist
func RemoveDuplicatedStrings ¶
RemoveDuplicatedStrings returns a string slice without duplicated elements. Order is NOT preserved
Types ¶
This section is empty.