Documentation ¶
Index ¶
- Variables
- func CachePath(m module.Version, suffix string) (string, error)
- func Download(mod module.Version) (dir string, err error)
- func DownloadDir(m module.Version) (string, error)
- func GoMod(path, rev string) ([]byte, error)
- func ImportRepoRev(path, rev string) (Repo, *RevInfo, error)
- func IsPseudoVersion(v string) bool
- func PseudoVersion(major string, t time.Time, rev string) string
- func PseudoVersionTime(v string) (time.Time, error)
- func SortVersions(list []string)
- func Sum(mod module.Version) string
- func Unzip(dir, zipfile, prefix string, maxSize int64) error
- func WriteGoSum()
- type Repo
- type RevInfo
Constants ¶
This section is empty.
Variables ¶
var ErrNotPseudoVersion = errors.New("not a pseudo-version")
var GoSumFile string // path to go.sum; set by package modload
var QuietLookup bool // do not print about lookups
var SrcMod string // $GOPATH/src/mod; set by package modload
Functions ¶
func Download ¶
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 GoMod ¶
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 ImportRepoRev ¶
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 IsPseudoVersion ¶
IsPseudoVersion reports whether v is a pseudo-version.
func PseudoVersionTime ¶
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 SortVersions ¶
func SortVersions(list []string)
Types ¶
type Repo ¶
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 downloads a zip file for the given version // to a new file in a given temporary directory. // It returns the name of the new file. // The caller should remove the file when finished with it. Zip(version, tmpdir string) (tmpfile string, err error) }
A Repo represents a repository storing all versions of a single module. It must be safe for simultaneous use by multiple goroutines.