pkgsite: golang.org/x/pkgsite/internal/version Index | Files

package version

import "golang.org/x/pkgsite/internal/version"

Package version handles version types.

Index

Package Files

version.go

Constants

const (
    // TypeRelease is a normal release.
    TypeRelease = Type("release")

    // TypePrerelease is a version with a prerelease.
    TypePrerelease = Type("prerelease")

    // TypePseudo appears to have a prerelease of the
    // form <commit date>-<commit hash>.
    TypePseudo = Type("pseudo")
)

func ForSorting Uses

func ForSorting(version string) string

ForSorting returns a string that encodes version, so that comparing two such strings follows SemVer precedence, https://semver.org clause 11. It assumes version is valid. The returned string ends in '~' if and only if the version does not have a prerelease.

For examples, see TestForSorting.

func IsPseudo Uses

func IsPseudo(v string) bool

IsPseudo reports whether a valid version v is a pseudo-version. Modified from src/cmd/go/internal/modfetch.

type Type Uses

type Type string

Type defines the version types a module can have. This must be kept in sync with the 'version_type' database enum.

func ParseType Uses

func ParseType(version string) (Type, error)

ParseType returns the Type of a given a version.

func (Type) String Uses

func (t Type) String() string

Package version imports 4 packages (graph) and is imported by 10 packages. Updated 2020-10-28. Refresh now. Tools for package owners.