Documentation
¶
Index ¶
- Variables
- func CompareVersion(v, w string) int
- func IsNewerVersion(oldversion, newversion string, major bool) bool
- func NextMajor(version string) (string, error)
- func Request(path string, cached bool) (*http.Response, error)
- func Updates(opt UpdateOptions)
- type Module
- func Latest(modpath string, cached, pre bool) (*Module, error)
- func List(modpath string, cached bool) ([]*Module, error)
- func MaxVersion(mods []*Module, pre bool, r Retractions) (*Module, string)
- func Query(modpath string, cached bool) (*Module, bool, error)
- func QueryPackage(pkgpath string, cached bool) (*Module, error)
- type Retractions
- type Update
- type UpdateOptions
- type VersionRange
Constants ¶
This section is empty.
Variables ¶
var ErrNoVersions = errors.New("no module versions found")
ErrNoVersions is returned when the proxy has no version for a module
Functions ¶
func CompareVersion ¶ added in v0.12.0
CompareVersion returns -1 if v < w, 1 if v > w, and 0 if v == w Incompatible versions are considered lower than non-incompatible ones. Invalid versions are considered lower than valid ones. If both versions are invalid, the empty string is returned.
func IsNewerVersion ¶ added in v0.8.0
IsNewerVersion returns true if newversion is greater than oldversion in terms of semver. If major is true, then newversion must be a major version ahead of oldversion to be considered newer.
func Request ¶ added in v0.13.0
Request sends requests to the module proxies in order and returns the first 200 response.
func Updates ¶ added in v0.8.0
func Updates(opt UpdateOptions)
Updates finds updates for a set of specified modules.
Types ¶
type Module ¶
Module contains the module path and versions
func Latest ¶
Latest finds the latest major version of a module cached sets the Disable-Module-Fetch: true header pre controls whether to return modules which only contain pre-release versions.
func List ¶ added in v0.9.6
List finds all the major versions of a module cached sets the Disable-Module-Fetch: true header
func MaxVersion ¶ added in v0.7.4
func MaxVersion(mods []*Module, pre bool, r Retractions) (*Module, string)
MaxVersion returns the latest version of the module in the list. If pre is false, pre-release versions will are excluded. Retracted versions are excluded.
func Query ¶
Query the module proxy for all versions of a module. If the module does not exist, the second return parameter will be false cached sets the Disable-Module-Fetch: true header
func QueryPackage ¶
QueryPackage tries to find the module path for the provided package path it does so by repeatedly chopping off the last path element and trying to use it as a path.
func (*Module) MaxVersion ¶
MaxVersion returns the latest version. If there are no versions, the empty string is returned. Prefix can be used to filter the versions based on a prefix. If pre is false, pre-release versions will are excluded.
func (*Module) NextMajorPath ¶
NextMajorPath returns the module path of the next major version
func (*Module) Retract ¶ added in v0.12.0
func (m *Module) Retract(r Retractions) *Module
Retract returns a copy of m with the retracted versions removed.
func (*Module) WithMajorPath ¶ added in v0.3.0
WithMajorPath returns the module path for the provided version
type Retractions ¶ added in v0.12.0
type Retractions []VersionRange
Retractions is a list of retracted versions.
func FetchRetractions ¶ added in v0.12.0
func FetchRetractions(mod *Module) (Retractions, error)
FetchRetractions fetches the retractions for this module.
func (Retractions) Includes ¶ added in v0.12.0
func (rr Retractions) Includes(v string) bool
Includes reports whether v is retracted
type Update ¶ added in v0.8.0
Update reports a newer version of a module. The Err field will be set if an error occured.
func (Update) MarshalJSON ¶ added in v0.11.0
MarshalJSON implements json.Marshaler
type UpdateOptions ¶ added in v0.8.0
type UpdateOptions struct {
Pre bool
Cached bool
Major bool
Modules []module.Version
OnUpdate func(Update)
}
UpdateOptions specifies a set of modules to check for updates. The OnUpdate callback will be invoked with any updates found.
type VersionRange ¶ added in v0.12.0
type VersionRange struct {
Low, High string
}
VersionRange is an inclusive version range.
func (VersionRange) Includes ¶ added in v0.12.0
func (r VersionRange) Includes(v string) bool
Includes reports whether v is in the inclusive range