Documentation ¶
Index ¶
- func CopyDir(src, dst *Path) error
- func CopyFile(src, dst *Path) error
- func ErrorString(err error) string
- func FileCompareEqual(file1, file2 *Path) bool
- func FormatArgs(args ...interface{}) string
- func PanicIf(cond bool, args ...interface{})
- func PanicIfErr(err error, args ...interface{})
- func ReadJsonFile(jsonPath string) (interface{}, error)
- func ReadJsonFileToData(jsonPath string, jsonOut interface{}) error
- type ExecCmd
- type Path
- func (p *Path) Absolute() string
- func (p *Path) Append(s string) *Path
- func (p *Path) Base() string
- func (p *Path) Chmod(mode os.FileMode) error
- func (p *Path) Clean() string
- func (p *Path) Copy() *Path
- func (p *Path) CreateDir() error
- func (p *Path) DeleteFile() error
- func (p *Path) Expand(mapping func(string) string) *Path
- func (p *Path) IsPathDir() bool
- func (p *Path) IsPathRegularFile() bool
- func (p *Path) ModTime() time.Time
- func (p *Path) Mode() os.FileMode
- func (p *Path) RemoveDir() error
- func (p *Path) SetStr(s string)
- func (p *Path) Size() int64
- func (p *Path) String() string
- type StringBuilder
- type WorkQueue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir copies from the given directory (src) and all of its files to the destination (dst).
func CopyFile ¶
CopyFile copies a file given by its path (src) creating an output file given its path (dst)
func ErrorString ¶
func FileCompareEqual ¶
FileCompareEqual compares two files returning true if they are equal.
func FormatArgs ¶
func FormatArgs(args ...interface{}) string
func PanicIfErr ¶
func PanicIfErr(err error, args ...interface{})
func ReadJsonFile ¶
ReadJsonFile preprocesses out comments and then unmarshals the data generically.
func ReadJsonFileToData ¶
ReadJsonFileToData preprocesses out comments and then unmarshals the data into a data structure previously defined.
Types ¶
type ExecCmd ¶
type ExecCmd struct {
// contains filtered or unexported fields
}
os.Exec contains further details
func NewExecCmd ¶
func (*ExecCmd) CommandString ¶
func (*ExecCmd) QuoteArgIfNeeded ¶
func (*ExecCmd) RunWithOutput ¶
RunWithOutput runs the previously set up command, gets the combined output of sysout and syserr, trims whitespace from it and returns if error free. If any error occurs, it is simply returned.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path provides a centralized
func NewHomeDir ¶
func NewHomeDir() *Path
NewHomeDir returns the current working directory as a Path.
func NewWorkDir ¶
func NewWorkDir() *Path
NewWorkDir returns the current working directory as a Path.
func (*Path) Append ¶
Append a subdirectory or file name[.file extension] to the path. If the string is empty, then '/' will be appended.
func (*Path) Base ¶
Base returns the last component of the path. If the path is empty, "." is returned.
func (*Path) CreateDir ¶
CreateDir assumes that this path represents a directory and creates it along with any parent directories needed as well.
func (*Path) DeleteFile ¶
DeleteFile assumes that this path represents a file and deletes it.
func (*Path) Expand ¶
Expand replaces ${var} or $var in the given path based on the mapping function returning a new path.
func (*Path) IsPathDir ¶
IsPathDir cleans up the supplied file path and then checks the cleaned file path to see if it is an existing standard directory.
func (*Path) IsPathRegularFile ¶
IsPathRegularFile cleans up the supplied file path and then checks the cleaned file path to see if it is an existing standard file.
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
StringBuilder is a composition of strings.Builder so that we can add supplemental functions such as formatted strings easily.
func NewStringBuilder ¶
func NewStringBuilder() *StringBuilder
func (*StringBuilder) Len ¶
func (s *StringBuilder) Len() int
func (*StringBuilder) String ¶
func (s *StringBuilder) String() string
func (*StringBuilder) WriteString ¶
func (s *StringBuilder) WriteString(format string) error
WriteString allows us to write a string to the buffer.
func (*StringBuilder) WriteStringf ¶
func (s *StringBuilder) WriteStringf(format string, a ...interface{}) error
WriteStringf allows us to write a formatted string.
type WorkQueue ¶
type WorkQueue struct {
// contains filtered or unexported fields
}
WorkQueue represents a one use only structure to execute multiple go routines easily.
func NewWorkQueue ¶
func (*WorkQueue) CloseAndWaitForCompletion ¶
func (w *WorkQueue) CloseAndWaitForCompletion()
func (*WorkQueue) CloseQueue ¶
func (w *WorkQueue) CloseQueue()