Documentation ¶
Overview ¶
This file mainly provides some functions that can be used to adapt for git downloading by go-getter.
Index ¶
- Constants
- func Clone(repoURL string, tagName string, localPath string, writer io.Writer) (*git.Repository, error)
- func CloneWithOpts(opts ...CloneOption) (*git.Repository, error)
- func ForceProtocol(url, protocol string) string
- func GetAllGithubReleases(url string) ([]string, error)
- type CloneOption
- type CloneOptions
- type GitHubRelease
Constants ¶
const GIT_PROTOCOL = "git::"
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone(repoURL string, tagName string, localPath string, writer io.Writer) (*git.Repository, error)
Clone will clone from `repoURL` to `localPath` via git by tag name. Deprecated: This function will be removed in a future version. Use CloneWithOpts instead.
func CloneWithOpts ¶
func CloneWithOpts(opts ...CloneOption) (*git.Repository, error)
CloneWithOpts will clone from `repoURL` to `localPath` via git by using CloneOptions
func ForceProtocol ¶
func GetAllGithubReleases ¶
GetAllGithubReleases fetches all releases from a GitHub repository
Types ¶
type CloneOption ¶
type CloneOption func(*CloneOptions)
CloneOption is a function that modifies CloneOptions
func WithBranch ¶
func WithBranch(branch string) CloneOption
WithBranch sets the branch for CloneOptions
func WithCommit ¶
func WithCommit(commit string) CloneOption
WithCommit sets the commit for CloneOptions
func WithLocalPath ¶
func WithLocalPath(localPath string) CloneOption
WithLocalPath sets the local path for CloneOptions
func WithRepoURL ¶
func WithRepoURL(repoURL string) CloneOption
WithRepoURL sets the repo URL for CloneOptions
func WithWriter ¶
func WithWriter(writer io.Writer) CloneOption
WithWriter sets the writer for CloneOptions
type CloneOptions ¶
type CloneOptions struct { RepoURL string Commit string Tag string Branch string LocalPath string Writer io.Writer }
CloneOptions is a struct for specifying options for cloning a git repository
func NewCloneOptions ¶
func NewCloneOptions(repoUrl, commit, tag, branch, localpath string, Writer io.Writer) *CloneOptions
func (*CloneOptions) Clone ¶
func (cloneOpts *CloneOptions) Clone() (*git.Repository, error)
Clone clones a git repository
func (*CloneOptions) ForceGitUrl ¶
func (cloneOpts *CloneOptions) ForceGitUrl() (string, error)
ForceGitUrl will add the branch, tag or commit to the git URL and force it to the git protocol `<URL>` will return `Git::<URL>?ref=<branch|tag|commit>`
func (*CloneOptions) Validate ¶
func (cloneOpts *CloneOptions) Validate() error
Validate checks if the CloneOptions are valid
type GitHubRelease ¶
type GitHubRelease struct {
TagName string `json:"tag_name"`
}