go/src/cmd/go/internal/vcs/vcs.go

type Cmd

type Status

var VCSTestRepoURL

var VCSTestHosts

var VCSTestIsLocalHost

var defaultSecureScheme

func (v *Cmd) IsSecure(repo string) bool {}

func (v *Cmd) isSecureScheme(scheme string) bool {}

type tagCmd

var vcsList

var vcsMod

// vcsByCmd returns the version control system for the given
// command name (hg, git, svn, bzr).
func vcsByCmd(cmd string) *Cmd {}

var vcsHg

func hgRemoteRepo(vcsHg *Cmd, rootDir string) (remoteRepo string, err error) {}

func hgStatus(vcsHg *Cmd, rootDir string) (Status, error) {}

// parseRevTime parses commit details in "revision:seconds" format.
func parseRevTime(out []byte) (string, time.Time, error) {}

var vcsGit

var scpSyntaxRe

func gitRemoteRepo(vcsGit *Cmd, rootDir string) (remoteRepo string, err error) {}

func gitStatus(vcsGit *Cmd, rootDir string) (Status, error) {}

var vcsBzr

func bzrRemoteRepo(vcsBzr *Cmd, rootDir string) (remoteRepo string, err error) {}

func bzrResolveRepo(vcsBzr *Cmd, rootDir, remoteRepo string) (realRepo string, err error) {}

func bzrStatus(vcsBzr *Cmd, rootDir string) (Status, error) {}

var vcsSvn

func svnRemoteRepo(vcsSvn *Cmd, rootDir string) (remoteRepo string, err error) {}

const fossilRepoName

var vcsFossil

func fossilRemoteRepo(vcsFossil *Cmd, rootDir string) (remoteRepo string, err error) {}

var errFossilInfo

func fossilStatus(vcsFossil *Cmd, rootDir string) (Status, error) {}

func (v *Cmd) String() string {}

// run runs the command line cmd in the given directory.
// keyval is a list of key, value pairs. run expands
// instances of {key} in cmd into value, but only after
// splitting cmd into individual arguments.
// If an error occurs, run prints the command line and the
// command's combined stdout+stderr to standard error.
// Otherwise run discards the command's output.
func (v *Cmd) run(dir string, cmd string, keyval ...string) error {}

// runVerboseOnly is like run but only generates error output to standard error in verbose mode.
func (v *Cmd) runVerboseOnly(dir string, cmd string, keyval ...string) error {}

// runOutput is like run but returns the output of the command.
func (v *Cmd) runOutput(dir string, cmd string, keyval ...string) ([]byte, error) {}

// runOutputVerboseOnly is like runOutput but only generates error output to
// standard error in verbose mode.
func (v *Cmd) runOutputVerboseOnly(dir string, cmd string, keyval ...string) ([]byte, error) {}

// run1 is the generalized implementation of run and runOutput.
func (v *Cmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([]byte, error) {}

// Ping pings to determine scheme to use.
func (v *Cmd) Ping(scheme, repo string) error {}

// Create creates a new copy of repo in dir.
// The parent of dir must exist; dir must not.
func (v *Cmd) Create(dir, repo string) error {}

// Download downloads any new changes for the repo in dir.
func (v *Cmd) Download(dir string) error {}

// Tags returns the list of available tags for the repo in dir.
func (v *Cmd) Tags(dir string) ([]string, error) {}

// TagSync syncs the repo in dir to the named tag,
// which either is a tag returned by tags or is v.tagDefault.
func (v *Cmd) TagSync(dir, tag string) error {}

type vcsPath

// FromDir inspects dir and its parents to determine the
// version control system and code repository to use.
// If no repository is found, FromDir returns an error
// equivalent to os.ErrNotExist.
func FromDir(dir, srcRoot string, allowNesting bool) (repoDir string, vcsCmd *Cmd, err error) {}

// isVCSRoot identifies a VCS root by checking whether the directory contains
// any of the listed root names.
func isVCSRoot(dir string, rootNames []rootName) bool {}

type rootName

type vcsNotFoundError

func (e *vcsNotFoundError) Error() string {}

func (e *vcsNotFoundError) Is(err error) bool {}

type govcsRule

type govcsConfig

func parseGOVCS(s string) (govcsConfig, error) {}

func (c *govcsConfig) allow(path string, private bool, vcs string) bool {}

var govcs

var govcsErr

var govcsOnce

var defaultGOVCS

// checkGOVCS checks whether the policy defined by the environment variable
// GOVCS allows the given vcs command to be used with the given repository
// root path. Note that root may not be a real package or module path; it's
// the same as the root path in the go-import meta tag.
func checkGOVCS(vcs *Cmd, root string) error {}

type RepoRoot

func httpPrefix(s string) string {}

type ModuleMode

const IgnoreMod

const PreferMod

// RepoRootForImportPath analyzes importPath to determine the
// version control system, and code repository to use.
func RepoRootForImportPath(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error) {}

var errUnknownSite

// repoRootFromVCSPaths attempts to map importPath to a repoRoot
// using the mappings defined in vcsPaths.
func repoRootFromVCSPaths(importPath string, security web.SecurityMode, vcsPaths []*vcsPath) (*RepoRoot, error) {}

func interceptVCSTest(repo string, vcs *Cmd, security web.SecurityMode) (repoURL string, ok bool) {}

// urlForImportPath returns a partially-populated URL for the given Go import path.
//
// The URL leaves the Scheme field blank so that web.Get will try any scheme
// allowed by the selected security mode.
func urlForImportPath(importPath string) (*urlpkg.URL, error) {}

// repoRootForImportDynamic finds a *RepoRoot for a custom domain that's not
// statically known by repoRootFromVCSPaths.
//
// This handles custom import paths like "name.tld/pkg/foo" or just "name.tld".
func repoRootForImportDynamic(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error) {}

// validateRepoRoot returns an error if repoRoot does not seem to be
// a valid URL with scheme.
func validateRepoRoot(repoRoot string) error {}

var fetchGroup

var fetchCacheMu

var fetchCache

// metaImportsForPrefix takes a package's root import path as declared in a <meta> tag
// and returns its HTML discovery URL and the parsed metaImport lines
// found on the page.
//
// The importPath is of the form "golang.org/x/tools".
// It is an error if no imports are found.
// url will still be valid if err != nil.
// The returned url will be of the form "https://golang.org/x/tools?go-get=1"
func metaImportsForPrefix(importPrefix string, mod ModuleMode, security web.SecurityMode) (*urlpkg.URL, []metaImport, error) {}

type fetchResult

type metaImport

type ImportMismatchError

func (m ImportMismatchError) Error() string {}

// matchGoImport returns the metaImport from imports matching importPath.
// An error is returned if there are multiple matches.
// An ImportMismatchError is returned if none match.
func matchGoImport(imports []metaImport, importPath string) (metaImport, error) {}

// expand rewrites s to replace {k} with match[k] for each key k in match.
func expand(match map[string]string, s string) string {}

var vcsPaths

var vcsPathsAfterDynamic

// noVCSSuffix checks that the repository name does not
// end in .foo for any version control system foo.
// The usual culprit is ".git".
func noVCSSuffix(match map[string]string) error {}

// launchpadVCS solves the ambiguity for "lp.net/project/foo". In this case,
// "foo" could be a series name registered in Launchpad with its own branch,
// and it could also be the name of a directory within the main project
// branch one level up.
func launchpadVCS(match map[string]string) error {}

type importError

func importErrorf(path, format string, args ...any) error {}

func (e *importError) Error() string {}

func (e *importError) Unwrap() error {}

func (e *importError) ImportPath() string {}