package modfetch

import "cmd/go/internal/modfetch"

Index

Variables

var ErrNotPseudoVersion = errors.New("not a pseudo-version")

Functions

func ConvertLegacyConfig

func ConvertLegacyConfig(f *modfile.File, file string, data []byte) error

ConvertLegacyConfig converts legacy config to modfile. The file argument is slash-delimited.

func Import

func Import(path string, allowed func(module.Version) bool) (Repo, *RevInfo, error)

func PseudoVersion

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

func SortVersions

func SortVersions(list []string)

func Unzip

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

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

func Lookup(path string) (Repo, error)

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

func Query(path, vers string, allowed func(module.Version) bool) (*RevInfo, error)

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 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

PathSynopsis
cmd/go/internal/modfetch/bitbucket
cmd/go/internal/modfetch/codehostPackage 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/gitrepoPackage 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.