Documentation
¶
Overview ¶
Package plainversion parses plain semantic versions, without allocating.
Index ¶
Constants ¶
const MaxPrerelease = 4
MaxPrerelease is the most prerelease identifiers that Parse keeps in the buffer that it is given.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶ added in v1.4.0
type Result uint8
Result is what Parse found.
const ( // Invalid means that semver.Make rejects the string. Invalid Result = iota // Valid means that semver.Make accepts the string and the version is the one Parse returned. Valid // Unsupported means that Parse did not decide: the string has a prerelease, and Parse was given no room for it or // the prerelease has more than MaxPrerelease identifiers. The caller uses semver.Make. Unsupported )
func Parse ¶
Parse parses "MAJOR.MINOR.PATCH" with optional "-prerelease" and "+build" metadata without allocating, and decides what semver.Make decides: Valid for a string it accepts, with the same Major, Minor, Patch and Pre, and Invalid for one that it rejects. The build metadata is validated and dropped since Compare ignores it. The prerelease identifiers are kept in pre, which the caller owns, and the Pre of the version is a slice of it. With a nil pre, or a prerelease of more than MaxPrerelease identifiers, Parse reports Unsupported for a string that has a prerelease.