Documentation ¶
Index ¶
- func Direct(dir string) ([]module.Version, error)
- func FindModFile(dir string) (string, error)
- func IsNewerVersion(oldversion, newversion string, major bool) bool
- func JoinPath(modprefix, version, pkgdir string) string
- func MaxVersion(v, w string) string
- func ModMajor(modpath string) (string, bool)
- func ModPrefix(modpath string) string
- func NextMajor(version string) (string, error)
- func SplitPath(modprefix, pkgpath string) (modpath, pkgdir string, ok bool)
- func SplitSpec(spec string) (path, query string)
- type Module
- type MultiModule
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindModFile ¶
FindModFile recursively searches up the directory structure until it finds the go.mod, reaches the root of the directory tree, or encounters an error.
func IsNewerVersion ¶
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 JoinPath ¶
JoinPath creates a full package path given a module prefix, version, and package directory.
func MaxVersion ¶
MaxVersion returns the larger of two versions according to semantic version precedence. 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.
Types ¶
type Module ¶
Module contains the module path and versions
func QueryCurrent ¶ added in v0.3.0
QueryCurrent finds the current major version of a module via go proxy. If the module does not exist, the second return parameter will be false cached sets the Disable-Module-Fetch: true header
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) WithMajorPath ¶
WithMajorPath returns the module path for the provided version
type MultiModule ¶ added in v0.3.0
type MultiModule struct { // Modules is a list of modules with different major versions, in ascending order. Modules []*Module }
MultiModule contains multiple modules with different major versions
func Query ¶
func Query(modpath string, cached bool) (*MultiModule, error)
Query finds the all versions of a module with major versions greater than or equal to current one. cached sets the Disable-Module-Fetch: true header
func (*MultiModule) Versions ¶ added in v0.3.0
func (mm *MultiModule) Versions() []string