Documentation ¶
Index ¶
- func IsPseudoVersion(v string) bool
- func IsZeroPseudoVersion(v string) bool
- func PseudoVersion(major, older string, t time.Time, rev string) string
- func PseudoVersionBase(v string) (string, error)
- func PseudoVersionRev(v string) (rev string, err error)
- func PseudoVersionTime(v string) (time.Time, error)
- func SortVersions(list []string)
- func ZeroPseudoVersion(major string) string
- type Repo
- type RevInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPseudoVersion ¶
IsPseudoVersion reports whether v is a pseudo-version.
func IsZeroPseudoVersion ¶
IsZeroPseudoVersion returns whether v is a pseudo-version with a zero base, timestamp, and revision, as returned by ZeroPseudoVersion.
func PseudoVersion ¶
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 PseudoVersionBase ¶
PseudoVersionBase returns the canonical parent version, if any, upon which the pseudo-version v is based.
If v has no parent version (that is, if it is "vX.0.0-[…]"), PseudoVersionBase returns the empty string and a nil error.
func PseudoVersionRev ¶
PseudoVersionRev returns the revision identifier of the pseudo-version v. It returns an error if v is not 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)
func ZeroPseudoVersion ¶
ZeroPseudoVersion returns a pseudo-version with a zero timestamp and revision, which may be used as a placeholder.
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 returns a non-nil error only if there was a problem // fetching the list of versions: it may return an empty list // along with a nil error if the list of matching versions // is known to be empty. // // If the underlying repository does not exist, // Versions returns an error matching errors.Is(_, os.NotExist). Versions(prefix string) ([]string, 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.
type RevInfo ¶
type RevInfo struct { Version string // suggested version string for this revision 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.