Documentation ¶
Index ¶
- func CloseAll(closers ...io.Closer) error
- func CreateRootTempDir() error
- func DirEmpty(path string) bool
- func DirExists(path string) bool
- func ExitCode(err error) int
- func FileExists(path string) bool
- func ForEachLine(path string, fn func(line string) bool) error
- func ForEachReaderLine(r io.Reader, fn func(line string) bool) error
- func GenericGet(m map[string]interface{}, path string) interface{}
- func GenericSet(mp *map[string]interface{}, path string, value interface{})
- func GetRootTempDir() string
- func GetTempDirPath() (string, error)
- func GetTempFilePath(filename string) (string, error)
- func Git(arg ...string) (string, error)
- func Must(err error)
- func MustReadJSONFile(filename string) *jnode.Node
- func PropagateCloseError(closer io.Closer, f func() error) (err error)
- func ReadJSONFile(filename string) (*jnode.Node, error)
- func RemoveJNodeElementsIf(n *jnode.Node, f func(*jnode.Node) bool) *jnode.Node
- func RemoveJNodeEntriesIf(n *jnode.Node, f func(key string, value *jnode.Node) bool) *jnode.Node
- func RemoveRootTempDir() string
- func Size(n uint64) string
- func StringSliceContains(s []string, t string) bool
- func TempFile(pattern string) (string, error)
- func TruncateRight(s string, m int) string
- type AtomicFileWriter
- type Cache
- type StringSet
- func (ss *StringSet) Add(s string) bool
- func (ss *StringSet) AddAll(values ...string) *StringSet
- func (ss *StringSet) Contains(s string) bool
- func (ss *StringSet) Get(i int) string
- func (ss *StringSet) Len() int
- func (ss *StringSet) MarshalJSON() ([]byte, error)
- func (ss *StringSet) Reset()
- func (ss *StringSet) Values() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseAll ¶ added in v0.4.21
CloseAll calls Close() on every closer, returning the err from the first one that returns a non-nil error.
func CreateRootTempDir ¶ added in v0.5.50
func CreateRootTempDir() error
CreateRootTempDir - call only once from root command
func ExitCode ¶ added in v0.4.31
Returns the exit code from an error if the error is an exec.ExitError, or -1 if the err is non-nil, or 0 otherwise.
func FileExists ¶ added in v0.4.56
func ForEachReaderLine ¶ added in v0.5.9
func GenericGet ¶ added in v0.5.7
func GenericSet ¶ added in v0.5.7
func GetRootTempDir ¶ added in v0.5.50
func GetRootTempDir() string
GetRootTempDir - return the absolute path to the root temp dir
func GetTempDirPath ¶ added in v0.5.54
GetTempDirPath - return a unique absolute path for a dir
func GetTempFilePath ¶ added in v0.5.50
GetTempFilePath - return a unique absolute path for a file with filename
func MustReadJSONFile ¶ added in v0.4.38
func MustReadJSONFile(filename string) *jnode.Node
func PropagateCloseError ¶ added in v0.4.21
PropagateCloseError calls f then calls closer.Close(), returning the error from Close() if f did not return an error. Errors from Close() when writing can return important errors that should not be thrown away.
func ReadJSONFile ¶ added in v0.4.36
func RemoveJNodeElementsIf ¶ added in v0.4.34
func RemoveJNodeElementsIf(n *jnode.Node, f func(*jnode.Node) bool) *jnode.Node
func RemoveJNodeEntriesIf ¶ added in v0.4.38
func RemoveRootTempDir ¶ added in v0.5.50
func RemoveRootTempDir() string
RemoveRootTempDir - remove the root tmp dir and all subdirs and files, should be called on exit
func StringSliceContains ¶
func TruncateRight ¶ added in v0.4.36
Replaces newlines in s with spaces and truncates with "..." if the len(s) is more than m. The resulting string will always be m characters or less.
Types ¶
type AtomicFileWriter ¶ added in v0.5.44
func NewAtomicFileWriter ¶ added in v0.5.44
func NewAtomicFileWriter(path string) (*AtomicFileWriter, error)
Creates a file writer that writes to a temporary file and can rename it to a target file when done. The temp file is created in the same directory as the target file; the rename operation should be atmoic in this case.
func (*AtomicFileWriter) Close ¶ added in v0.5.44
func (a *AtomicFileWriter) Close() error
Closes and deletes the tempfile unless it has already been renamed.
func (*AtomicFileWriter) Rename ¶ added in v0.5.44
func (a *AtomicFileWriter) Rename() error
Closes and renames the temp file.
type Cache ¶ added in v0.4.39
type Cache struct {
// contains filtered or unexported fields
}
A simple-minded not-scalable LFU cache.
type StringSet ¶ added in v0.4.7
type StringSet struct {
// contains filtered or unexported fields
}
func NewStringSet ¶ added in v0.4.7
func NewStringSet() *StringSet
func NewStringSetWithValues ¶ added in v0.4.15
func (*StringSet) Add ¶ added in v0.4.7
Adds s to the set and returns true if the string wasn't already present