package vcs
import "cmd/go/internal/vcs"
Index ¶
- Variables
- type Cmd
- func FromDir(dir, srcRoot string) (repoDir string, vcsCmd *Cmd, err error)
- func (v *Cmd) IsSecure(repo string) bool
- func (v *Cmd) Ping(scheme, repo string) error
- func (v *Cmd) String() string
- type ImportMismatchError
- type ModuleMode
- type RepoRoot
- type Status
Variables ¶
var ( // VCSTestRepoURL is the URL of the HTTP server that serves the repos for // vcs-test.golang.org. // // In tests, this is set to the URL of an httptest.Server hosting a // cmd/go/internal/vcweb.Server. VCSTestRepoURL string // VCSTestHosts is the set of hosts supported by the vcs-test server. VCSTestHosts []string // VCSTestIsLocalHost reports whether the given URL refers to a local // (loopback) host, such as "localhost" or "127.0.0.1:8080". VCSTestIsLocalHost func(*urlpkg.URL) bool )
Types ¶
type Cmd ¶
type Cmd struct {
Name string
Cmd string // name of binary to invoke command
Env []string // any environment values to set/override
RootNames []rootName // filename and mode indicating the root of a checkout directory
Scheme []string
PingCmd string
Status func(v *Cmd, rootDir string) (Status, error)
}
A Cmd describes how to use a version control system like Mercurial, Git, or Subversion.
func FromDir ¶
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 (*Cmd) IsSecure ¶
func (*Cmd) Ping ¶
Ping pings to determine scheme to use.
func (*Cmd) String ¶
type ImportMismatchError ¶
type ImportMismatchError struct {
// contains filtered or unexported fields
}
An ImportMismatchError is returned where metaImport/s are present but none match our import path.
func (ImportMismatchError) Error ¶
func (m ImportMismatchError) Error() string
type ModuleMode ¶
type ModuleMode int
ModuleMode specifies whether to prefer modules when looking up code sources.
const ( IgnoreMod ModuleMode = iota PreferMod )
type RepoRoot ¶
type RepoRoot struct {
Repo string // repository URL, including scheme
Root string // import path corresponding to the SubDir
SubDir string // subdirectory within the repo (empty for root)
IsCustom bool // defined by served <meta> tags (as opposed to hard-coded pattern)
VCS *Cmd
}
RepoRoot describes the repository root for a tree of source code.
func RepoRootForImportPath ¶
func RepoRootForImportPath(importPath string, mod ModuleMode, security web.SecurityMode) (*RepoRoot, error)
RepoRootForImportPath analyzes importPath to determine the version control system, and code repository to use.
type Status ¶
type Status struct {
Revision string // Optional.
CommitTime time.Time // Optional.
Uncommitted bool // Required.
}
Status is the current state of a local repository.
Source Files ¶
- Version
- v1.25.6
- Published
- Jan 8, 2026
- Platform
- linux/amd64
- Imports
- 25 packages
- Last checked
- 16 seconds ago –
Tools for package owners.