source

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetModInfo

func GetModInfo(req *http.Request, prefix string) (path string, suffix string, err error)

GetModInfo retrieves mod info from URL

func PathEncoding added in v0.0.3

func PathEncoding(path string) (string, error)

PathEncoding returns go module encoded path

Types

type Plugin

type Plugin interface {
	Source(req *http.Request, prefix string) (Source, error)
	Leave(source Source) error
	Close() error
}

Plugin gives a way to get a source object for a request

type RevInfo

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
}

RevInfo describes a single revision in a module repository.

type Source

type Source 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(ctx context.Context, 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(ctx context.Context, rev string) (*RevInfo, error)

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

	// Zip returns file reader of ZIP file for the given version of the module
	Zip(ctx context.Context, version string) (file io.ReadCloser, err error)
}

Source represents source of code: some VSC (git, mercurial, svn, etc), Gitlab, another Go modules proxy, etc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL