Documentation ¶
Index ¶
- Variables
- func CanonicalPath(path string, basePath string) (string, error)
- func CanonicalPaths(paths []string, basePath string) ([]string, error)
- func CheckAndExit(err error)
- func CheckAndStackTrace(err error)
- func CheckErr(err error) bool
- func CheckOS()
- func CleanPath(path string) string
- func CopyFile(source string, destination string) error
- func CopyFolderContents(source, destination, manifestFile string) error
- func CopyFolderContentsWithFilter(source, destination, manifestFile string, filter func(path string) bool) error
- func EncodeBase64Sha1(str string) string
- func FileExists(path string) bool
- func FileNotExists(path string) bool
- func GetPathRelativeTo(path string, basePath string) (string, error)
- func Grep(regex *regexp.Regexp, glob string) (bool, error)
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsSymLink(path string) bool
- func JoinPath(elem ...string) string
- func JoinTerraformModulePath(modulesFolder string, path string) string
- func MustExec(name string, arg ...string)
- func MustExecNoOut(name string, arg ...string)
- func MustExecRtOut(name string, arg ...string) string
- func PathContainsHiddenFileOrFolder(path string) bool
- func ReadFileAsString(path string) (string, error)
- func Root() bool
- func TryExec(name string, arg ...string) error
- func WriteFileWithSamePermissions(source string, destination string, contents []byte) error
Constants ¶
This section is empty.
Variables ¶
var CurrentPath string
Functions ¶
func CanonicalPath ¶
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 ¶
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 CheckAndExit ¶
func CheckAndExit(err error)
func CheckAndStackTrace ¶
func CheckAndStackTrace(err error)
func CleanPath ¶
Use this function when cleaning paths to ensure the returned path uses / as the path separator to improve cross-platform compatibility
func CopyFolderContents ¶
Copy the files and folders within the source folder into the destination folder. Note that hidden files and folders (those starting with a dot) will be skipped. Will create a specified manifest file that contains paths of all copied files.
func CopyFolderContentsWithFilter ¶
func CopyFolderContentsWithFilter(source, destination, manifestFile string, filter func(path string) bool) error
Copy the files and folders within the source folder into the destination folder. Pass each file and folder through the given filter function and only copy it if the filter returns true. Will create a specified manifest file that contains paths of all copied files.
func EncodeBase64Sha1 ¶
Returns the base 64 encoded sha1 hash of the given string
func FileNotExists ¶
Return true if the given file does not exist
func GetPathRelativeTo ¶
Return the relative path you would have to take to get from basePath to path
func Grep ¶
Returns true if the given regex can be found in any of the files matched by the given glob
func IsSymLink ¶
IsSymLink returns true if the given file is a symbolic link Per https://stackoverflow.com/a/18062079/2308858
func JoinPath ¶
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 JoinTerraformModulePath ¶
Join two paths together with a double-slash between them, as this is what Terraform uses to identify where a "repo" ends and a path within the repo begins. Note: The Terraform docs only mention two forward-slashes, so it's not clear if on Windows those should be two back-slashes? https://www.terraform.io/docs/modules/sources.html
func MustExecNoOut ¶
func MustExecRtOut ¶
func ReadFileAsString ¶
Return the contents of the file at the given path as a string
Types ¶
This section is empty.