Documentation ¶
Index ¶
- Variables
- func CopyFile(src, dst string, overwrite bool) error
- func CreateFiles(root string, mode os.FileMode, files map[string][]byte) error
- func FileExists(f string) (bool, error)
- func FileToQuote(file string) (string, error)
- func FmtDuration(t time.Duration, dp uint, radix time.Duration) string
- func IndentLines(n int, v string, s string) string
- func IsDir(f string) (bool, error)
- func IsRegFile(f string) (bool, error)
- func NoCheckCopyFile(src, dst string) error
- func Popd() error
- func Pushd(dir string) error
- func SameFile(a, b string) (bool, error)
- func StripSpace(s string) string
- func ToUnixMilli(t time.Time) int64
- func Wrap(e error, m string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
var WorkDirHistory = []string{}
WorkDirHistory is the working directory stack used by Pushd and Popd functions.
Functions ¶
func CreateFiles ¶
CreateFiles creates the files and directories within 'files' with 'root' as the root directory. 'files' contains a set of relative file paths mapped to the their required content. If the file is a directory it must be suffixed with a '/' and the mapped data will be ignored.
func FileExists ¶
FileExists returns true if the file exists, false if not, and an error if file existence could not be determined.
func FileToQuote ¶
FileToQuote returns the bytes of the input file as as a quoted string so it may be embedded in source code. Use []byte(quotedString) to decode.
func FmtDuration ¶
FmtDuration returns the duration as a string using 'dp' to specify decimal points and 'radix' to specify units. Unit suffix is added only if it matches a metric time unit between (inclusive) nanoseconds and hours.
Print in milliseconds: ``` DurationString(time.Millisecond) ```
Custom radix in relation to time.Nanosecond: ``` // tens of microseconds DurationString(10 * 1000 * 1000) ```
func IndentLines ¶
Indent creates a prefix of 'n' instances of 'v' which it prepends to each line of 's'. Returns 's' unchanged if 'n' is 0 or 'v' is empty. A panic occurs if 'n' is negative.
func IsDir ¶
IsDir returns true if the file exists and is a directory. An error is returned if this could not be determined.
func IsRegFile ¶
IsRegFile returns true if the file exists and is a regular file. An error is returned if this could not be determined.
func NoCheckCopyFile ¶
NoCheckCopyFile copies the single file 'src' to 'dst' and doesn't make any attempt to check the file paths before hand.
func SameFile ¶
SameFile returns true if the two files 'a' and 'b' describe the same file as determined by os.SameFile. An error is returned if the file info could not be retreived for either file.
func StripSpace ¶
StripSpace removes all white space from a string.
func ToUnixMilli ¶
ToUnixMilli returns the input Time as Unix milliseconds.
Types ¶
This section is empty.