Go: cmd/go/internal/modfetch Index | Files | Directories

package modfetch

import "cmd/go/internal/modfetch"

Index

Package Files

cache.go coderepo.go fetch.go proxy.go pseudo.go repo.go unzip.go web.go

Variables

var GoSumFile string // path to go.sum; set by package modload
var HelpGoproxy = &base.Command{
    UsageLine: "goproxy",
    Short:     "module proxy protocol",
    Long:      "" /* 2857 byte string literal not displayed */,
}
var PkgMod string // $GOPATH/pkg/mod; set by package modload
var QuietLookup bool // do not print about lookups

func CachePath Uses

func CachePath(m module.Version, suffix string) (string, error)

func Download Uses

func Download(mod module.Version) (dir string, err error)

Download downloads the specific module version to the local download cache and returns the name of the directory corresponding to the root of the module's file tree.

func DownloadDir Uses

func DownloadDir(m module.Version) (string, error)

DownloadDir returns the directory to which m should be downloaded. Note that the directory may not yet exist.

func DownloadZip Uses

func DownloadZip(mod module.Version) (zipfile string, err error)

DownloadZip downloads the specific module version to the local zip cache and returns the name of the zip file.

func GoMod Uses

func GoMod(path, rev string) ([]byte, error)

GoMod is like Lookup(path).GoMod(rev) but avoids the repository path resolution in Lookup if the result is already cached on local disk.

func GoModFile Uses

func GoModFile(path, version string) (string, error)

GoModFile is like GoMod but returns the name of the file containing the cached information.

func GoModSum Uses

func GoModSum(path, version string) (string, error)

GoModSum returns the go.sum entry for the module version's go.mod file. (That is, it returns the entry listed in go.sum as "path version/go.mod".)

func ImportRepoRev Uses

func ImportRepoRev(path, rev string) (Repo, *RevInfo, error)

ImportRepoRev returns the module and version to use to access the given import path loaded from the source code repository that the original "go get" would have used, at the specific repository revision (typically a commit hash, but possibly also a source control tag).

func InfoFile Uses

func InfoFile(path, version string) (string, error)

InfoFile is like Stat but returns the name of the file containing the cached information.

func IsPseudoVersion Uses

func IsPseudoVersion(v string) bool

IsPseudoVersion reports whether v is a pseudo-version.

func PseudoVersion Uses

func PseudoVersion(major, older string, t time.Time, rev string) string

PseudoVersion returns a pseudo-version for the given major version ("v1") preexisting older tagged version ("" or "v1.2.3" or "v1.2.3-pre"), revision time, and revision identifier (usually a 12-byte commit hash prefix).

func PseudoVersionRev Uses

func PseudoVersionRev(v string) (rev string, err error)

PseudoVersionRev returns the revision identifier of the pseudo-version v. It returns an error if v is not a pseudo-version.

func PseudoVersionTime Uses

func PseudoVersionTime(v string) (time.Time, error)

PseudoVersionTime returns the time stamp of the pseudo-version v. It returns an error if v is not a pseudo-version or if the time stamp embedded in the pseudo-version is not a valid time.

func RemoveAll Uses

func RemoveAll(dir string) error

RemoveAll removes a directory written by Download or Unzip, first applying any permission changes needed to do so.

func SideLock Uses

func SideLock() (unlock func())

SideLock locks a file within the module cache that that guards edits to files outside the cache, such as go.sum and go.mod files in the user's working directory. It returns a function that must be called to unlock the file.

func SortVersions Uses

func SortVersions(list []string)

func Sum Uses

func Sum(mod module.Version) string

Sum returns the checksum for the downloaded copy of the given module, if present in the download cache.

func TrimGoSum Uses

func TrimGoSum(keep map[module.Version]bool)

TrimGoSum trims go.sum to contain only the modules for which keep[m] is true.

func Unzip Uses

func Unzip(dir, zipfile, prefix string, maxSize int64) error

func WriteGoSum Uses

func WriteGoSum()

WriteGoSum writes the go.sum file if it needs to be updated.

type Repo Uses

type Repo interface {
    // ModulePath returns the module path.
    ModulePath() string

    // Versions lists all known versions with the given prefix.
    // Pseudo-versions are not included.
    // Versions should be returned sorted in semver order
    // (implementations can use SortVersions).
    Versions(prefix string) (tags []string, err error)

    // Stat returns information about the revision rev.
    // A revision can be any identifier known to the underlying service:
    // commit hash, branch, tag, and so on.
    Stat(rev string) (*RevInfo, error)

    // Latest returns the latest revision on the default branch,
    // whatever that means in the underlying source code repository.
    // It is only used when there are no tagged versions.
    Latest() (*RevInfo, error)

    // GoMod returns the go.mod file for the given version.
    GoMod(version string) (data []byte, err error)

    // Zip writes a zip file for the given version to dst.
    Zip(dst io.Writer, version string) error
}

A Repo represents a repository storing all versions of a single module. It must be safe for simultaneous use by multiple goroutines.

func Lookup Uses

func Lookup(path string) (Repo, error)

Lookup returns the module with the given module path. A successful return does not guarantee that the module has any defined versions.

type RevInfo Uses

type RevInfo struct {
    Version string    // version string
    Time    time.Time // commit time

    // These fields are used for Stat of arbitrary rev,
    // but they are not recorded when talking about module versions.
    Name  string `json:"-"` // complete ID in underlying repository
    Short string `json:"-"` // shortened ID, for use in pseudo-version
}

A Rev describes a single revision in a module repository.

func Stat Uses

func Stat(path, rev string) (*RevInfo, error)

Stat is like Lookup(path).Stat(rev) but avoids the repository path resolution in Lookup if the result is already cached on local disk.

Directories

PathSynopsis
codehostPackage codehost defines the interface implemented by a code hosting source, along with support code for use by implementations.

Package modfetch imports 30 packages (graph) and is imported by 21 packages. Updated 2019-03-16. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: