{"modulePath":"github.com/micro/services","version":"v1.6.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package git\n\n## Constants\n\n```go\nconst CredentialsKey = \"GIT_CREDENTIALS\"\n```\n\n## Functions\n\n```go\nfunc CheckoutSource(source *Source, secrets map[string]string) (string, error)\n```\nCheckoutSource checks out a git repo (source) into a local temp directory. It will return the source of the local repo an an error if one occured. Secrets can optionally be passed if the repo is private.\n\n```go\nfunc GetRepoRoot(fullPath string) (string, error)\n```\nGetRepoRoot determines the repo root from a full path. Returns empty string and no error if not found\n\n```go\nfunc IsLocal(workDir, source string, pathExistsFunc ...func(path string) (bool, error)) (bool, string)\n```\nIsLocal tries returns true and full path of directory if the path is a local one, and false and empty string if not.\n\n```go\nfunc Uncompress(src string, dst string) error\n```\nUncompress is a modified version of: [https://gist.github.com/mimoo/25fc9716e0f1353791f5908f94d6e726](https://gist.github.com/mimoo/25fc9716e0f1353791f5908f94d6e726)\n\n## Types\n\n```go\ntype Gitter interface {\n\tCheckout(repo, branchOrCommit string) error\n\tRepoDir() string\n}\n```\n\n```go\nfunc NewGitter(secrets map[string]string) Gitter\n```\n\n```go\ntype Source struct {\n\t// is it a local folder intended for a local runtime?\n\tLocal bool\n\t// absolute path to service folder in local mode\n\tFullPath string\n\t// path of folder to repo root\n\t// be it local or github repo\n\tFolder string\n\t// github ref\n\tRef string\n\t// for cloning purposes\n\t// blank for local\n\tRepo string\n\t// dir to repo root\n\t// blank for non local\n\tLocalRepoRoot string\n}\n```\nSource is not just git related @todo move\n\n```go\nfunc ParseSource(source string) (*Source, error)\n```\nParseSource parses a \\`micro run/update/kill\\` source.\n\n```go\nfunc ParseSourceLocal(workDir, source string, pathExistsFunc ...func(path string) (bool, error)) (*Source, error)\n```\nParseSourceLocal a version of ParseSource that detects and handles local paths. Workdir should be used only from the CLI @todo better interface for this function. PathExistsFunc exists only for testing purposes, to make the function side effect free.\n\n```go\nfunc (s *Source) RuntimeName() string\n```\nName to be passed to RPC call runtime.Create Update Delete eg: \\`helloworld/api\\`, \\`crufter/myrepo/helloworld/api\\`, \\`localfolder\\`\n\n```go\nfunc (s *Source) RuntimeSource() string\n```\nSource to be passed to RPC call runtime.Create Update Delete eg: \\`helloworld\\`, \\`github.com/crufter/myrepo/helloworld\\`, \\`/path/to/localrepo/localfolder\\`\n\n","path":"github.com/micro/services/pkg/git","name":"git","synopsis":"","isRedistributable":true}
