Documentation ¶
Overview ¶
Package module provides functionalities for working with module path and versions.
Index ¶
Constants ¶
View Source
const ( // ErrInvalidVersion indicates that the version is invalid. ErrInvalidVersion = xerrors.Error("invalid version") )
Variables ¶
View Source
var ( // PathVersionRegExp matches a module version string. PathVersionRegExp = regexp.MustCompile(`^([a-zA-Z0-9]+([a-zA-Z0-9_/]+)?)?v\d+\.\d+\.\d+$`) // VersionRegExp matches a version string. VersionRegExp = regexp.MustCompile(`^v?(\d+)\.(\d+)\.(\d+)$`) // MajorVersionRegExp matches a major version string. MajorVersionRegExp = regexp.MustCompile(`^v?(\d+)$`) )
Functions ¶
func FindVersions ¶
FindVersions returns the module versions in the given path.
func PathVersion ¶
PathVersion returns the path and version from a module version string.
func PathWithVersion ¶ added in v0.4.0
PathWithVersion returns the path with the version.
func PathWithoutVersion ¶ added in v0.4.0
PathWithoutVersion returns the path without the version.
Types ¶
type Version ¶
Version is the version of the module.
func NewVersion ¶
NewVersion returns a new version.
func NewVersionFromString ¶
NewVersionFromString returns a new version from a string.
Click to show internal directories.
Click to hide internal directories.