plainversion

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: MIT, MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package plainversion parses plain semantic versions, without allocating.

Index

Constants

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL