Documentation
¶
Index ¶
- func FileExists(filePath string) bool
- func FileExistsInPath(fileName string) bool
- func GetLocalIP() (ip string)
- func GetPathParts(path string) (dirPath, fileName, absPath string)
- func GetThisPathParts() (dirPath, fileName, absPath string)
- func HomeDir() string
- func IsDirEmpty(name string) (bool, error)
- func IsTCPPortAvailable(port int) bool
- func LineReader(r io.Reader) (<-chan string, error)
- func LineReaderFrom(path string) (<-chan string, error)
- func ParseAddress(addr string) (proto string, path string, err error)
- func RandomString(length int) string
- func RandomTCPPort() int
- func ReadFileToString(path string) (string, error)
- func StringInSlice(a string, list []string) bool
- func StringInSliceCS(a string, list []string) bool
- func Trim(text string) string
- func WriteIndented(w io.Writer, b []byte) error
- func WriteIndentedN(w io.Writer, b []byte, n int) error
- func WriteStringToFile(text, path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
FileExists returns a flag indicating whether a provided file path exists.
func FileExistsInPath ¶
FileExistsInPath returns a flag indicating whether the provided file exists in the current path.
func GetLocalIP ¶
func GetLocalIP() (ip string)
GetLocalIP returns the non loopback local IP of the host
func GetPathParts ¶
GetPathParts returns the absolute directory path, the file name, and the absolute path of the provided path string.
func GetThisPathParts ¶
func GetThisPathParts() (dirPath, fileName, absPath string)
GetThisPathParts returns the same information as GetPathParts for the current executable.
func HomeDir ¶
func HomeDir() string
HomeDir returns the home directory of the user that owns the current process.
func IsDirEmpty ¶
IsDirEmpty returns a flag indicating whether or not a directory has any child objects such as files or directories in it.
func IsTCPPortAvailable ¶
IsTCPPortAvailable returns a flag indicating whether or not a TCP port is available.
func LineReader ¶
LineReader returns a channel that reads the contents of a reader line-by-line.
func LineReaderFrom ¶
LineReaderFrom returns a channel that reads the contents of a file line-by-line.
func ParseAddress ¶
ParseAddress parses a standard golang network address and returns the protocol and path.
func RandomString ¶
RandomString generates a random set of characters with the given lenght.
func RandomTCPPort ¶
func RandomTCPPort() int
RandomTCPPort gets a free, random TCP port between 1025-65535. If no free ports are available -1 is returned.
func ReadFileToString ¶
ReadFileToString reads the file at the provided path to a string.
func StringInSlice ¶
StringInSlice returns a flag indicating whether or not a provided string exists in a string slice. The string comparison is case-insensitive.
func StringInSliceCS ¶
StringInSliceCS returns a flag indicating whether or not a provided string exists in a string slice. The string comparison is case-sensitive.
func Trim ¶
Trim removes all leading and trailing whitespace, including tab, newline, and carriage return characters.
func WriteIndented ¶
WriteIndented indents all lines four spaces.
func WriteIndentedN ¶
WriteIndentedN indents all lines n spaces.
func WriteStringToFile ¶
WriteStringToFile writes the string to the file at the provided path.
Types ¶
This section is empty.