util

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(src, dst string) (int64, error)

CopyFile uses io.Copy() to copy a file to another location This was copied from https://opensource.com/article/18/6/copying-files-go

func CopyFolder

func CopyFolder(source, dest string) error

CopyFolder recursively copies an entire directory to another location (ignoring symlinks)

func CopyFolderWithFilter

func CopyFolderWithFilter(source, dest string, includeFilter IncludeFilter) (err error)

CopyFolderWithFilter recursively copies an entire directory to another location (ignoring symlinks) with an optional filter function to include/exclude folders or files

func ExeDir

func ExeDir() (string, error)

ExeDir returns the absolute path to the current executing binary (not including the filename)

func ExecAndCaptureOutput

func ExecAndCaptureOutput(command string, args ...string) (string, string, error)

ExecAndCaptureOutput runs the specified command and args and captures stdout into a string, returning the string or an error upon completion.

func FileExists

func FileExists(filePath string) bool

FileExists checks to see if the specified file (or directory) exists

func GetFirstLineFromFile

func GetFirstLineFromFile(netFile string) (string, error)

GetFirstLineFromFile retrieves the first line of the specified file.

func IsDir

func IsDir(path string) bool

IsDir returns true if the specified directory is valid

func RaiseRlimit

func RaiseRlimit(amount uint64) error

RaiseRlimit increases the number of file descriptors we can have

Types

type IncludeFilter

type IncludeFilter func(name string, info os.FileInfo) bool

IncludeFilter is a callback for filtering files and folders encountered while copying with CopyFileWithFilter()

Directories

Path Synopsis
Package bloom implements Bloom filters.
Package bloom implements Bloom filters.
Package db defines database utility functions.
Package db defines database utility functions.
Package metrics provides a metric logging wrappers for Prometheus server.
Package metrics provides a metric logging wrappers for Prometheus server.
Package timers provides a Clock abstraction useful for simulating timeouts.
Package timers provides a Clock abstraction useful for simulating timeouts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL