Documentation ¶
Index ¶
- func CanonicalPath(path string, basePath string) (string, error)
- func CanonicalPaths(paths []string, basePath string) ([]string, error)
- func CleanPath(path string) string
- func CreateLogger(prefix string) *log.Logger
- func FileExists(path string) bool
- func GetPathRelativeTo(path string, basePath string) (string, error)
- func GetRandomTime(lowerBound, upperBound time.Duration) time.Duration
- func Grep(regex *regexp.Regexp, glob string) (bool, error)
- func JoinPath(elem ...string) string
- func ListContainsElement(list []string, element string) bool
- func ReadFileAsString(path string) (string, error)
- func RemoveElementFromList(list []string, element string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalPath ¶ added in v0.6.0
Return the canonical version of the given path, relative to the given base path. That is, if the given path is a relative path, assume it is relative to the given base path. A canonical path is an absolute path with all relative components (e.g. "../") fully resolved, which makes it safe to compare paths as strings.
func CanonicalPaths ¶ added in v0.6.0
Return the canonical version of the given paths, relative to the given base path. That is, if a given path is a relative path, assume it is relative to the given base path. A canonical path is an absolute path with all relative components (e.g. "../") fully resolved, which makes it safe to compare paths as strings.
func CleanPath ¶ added in v0.9.0
Use this function when cleaning paths to ensure the returned path uses / as the path separator to improve cross-platform compatibility
func CreateLogger ¶ added in v0.6.0
Create a logger with the given prefix
func GetPathRelativeTo ¶ added in v0.4.0
Return the relative path you would have to take to get from basePath to path
func GetRandomTime ¶ added in v0.6.4
Get a random time duration between the lower bound and upper bound. This is useful because some of our automated tests wound up flooding the AWS API all at once, leading to a "Subscriber limit exceeded" error. TODO: Some of the more exotic test cases fail, but it's not worth catching them given the intended use of this function.
func Grep ¶
Returns true if the given regex can be found in any of the files matched by the given glob
func JoinPath ¶ added in v0.9.0
Windows systems use \ as the path separator *nix uses / Use this function when joining paths to force the returned path to use / as the path separator This will improve cross-platform compatibility
func ListContainsElement ¶ added in v0.6.0
Return true if the given list contains the given element
func ReadFileAsString ¶ added in v0.4.0
Return the contents of the file at the given path as a string
func RemoveElementFromList ¶ added in v0.6.0
Return a copy of the given list with all instances of the given element removed
Types ¶
This section is empty.