package modfetch
import "cmd/go/internal/modfetch"
Index ¶
- Variables
- func ConvertLegacyConfig(f *modfile.File, file string, data []byte) error
- func Import(path string, allowed func(module.Version) bool) (Repo, *RevInfo, error)
- func PseudoVersion(major string, t time.Time, rev string) string
- func SortVersions(list []string)
- func Unzip(dir, zipfile, prefix string, maxSize int64) error
- type ModuleSubdirError
- type Repo
- type RevInfo
Variables ¶
Functions ¶
func ConvertLegacyConfig ¶
ConvertLegacyConfig converts legacy config to modfile. The file argument is slash-delimited.
func Import ¶
func PseudoVersion ¶
func SortVersions ¶
func SortVersions(list []string)
func Unzip ¶
Types ¶
type ModuleSubdirError ¶
type ModuleSubdirError struct { ModulePath string }
func (*ModuleSubdirError) Error ¶
func (e *ModuleSubdirError) Error() string
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.
func Lookup ¶
Lookup returns the module with the given module path.
type RevInfo ¶
type RevInfo struct { Version string // version string Name string // complete ID in underlying repository Short string // shortened ID, for use in pseudo-version Time time.Time // commit time }
A Rev describes a single revision in a module repository.
func Query ¶
Query looks up a revision of a given module given a version query string. The module must be a complete module path. The version must take one of the following forms:
- the literal string "latest", denoting the latest available tagged version
- v1.2.3, a semantic version string
- v1 or v1.2, an abbreviated semantic version string completed by adding zeroes (v1.0.0 or v1.2.0);
- >v1.2.3, denoting the earliest available version after v1.2.3
- <v1.2.3, denoting the latest available version before v1.2.3
- an RFC 3339 time stamp, denoting the latest available version at that time
- a Unix time expressed as seconds since 1970, denoting the latest available version at that time
- a repository commit identifier, denoting that version
The time stamps can be followed by an optional @branch suffix to limit the result to revisions on a particular branch name.
Source Files ¶
coderepo.go convert.go domain.go gopkgin.go proxy.go query.go repo.go unzip.go web.go
Directories ¶
Path | Synopsis |
---|---|
cmd/go/internal/modfetch/bitbucket | |
cmd/go/internal/modfetch/codehost | Package codehost defines the interface implemented by a code hosting source, along with support code for use by implementations. |
cmd/go/internal/modfetch/github | |
cmd/go/internal/modfetch/gitrepo | Package gitrepo provides a Git-based implementation of codehost.Repo. |
cmd/go/internal/modfetch/googlesource |
- Version
- v1.11.0-beta.1
- Published
- Jun 26, 2018
- Platform
- js/wasm
- Imports
- 27 packages
- Last checked
- 1 minute ago –
Tools for package owners.