Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GitURLPatterns = []*regexp.Regexp{
	regexp.MustCompile(`^https?://.*\.git/?$`),
	regexp.MustCompile(`^https?://github\.com/[^/]+/[^/]+/?$`),
	regexp.MustCompile(`^https?://gitlab\.com/[^/]+/[^/]+/?$`),
	regexp.MustCompile(`^https?://bitbucket\.org/[^/]+/[^/]+/?$`),
	regexp.MustCompile(`^git@.*:.*\.git$`),
	regexp.MustCompile(`^ssh://git@.*/.*/.*\.git$`),
}

GitURLPatterns contains regex patterns to detect Git URLs

Functions

func CloneRepository

func CloneRepository(url string) (string, func(), error)

CloneRepository clones a Git repository to a temporary directory Returns the path to the cloned directory and a cleanup function

func GetRepoName

func GetRepoName(url string) string

GetRepoName extracts a repository name from a Git URL for display purposes

func IsGitURL

func IsGitURL(url string) bool

IsGitURL checks if the given string appears to be a Git repository URL

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL