package version
Import Path
go/version (on go.dev)
Dependency Relation
imports 2 packages, and imported by one package
Involved Source Files
Package version provides operations on [Go versions]
in [Go toolchain name syntax]: strings like
"go1.20", "go1.21.0", "go1.22rc2", and "go1.23.4-bigcorp".
Package-Level Functions (total 3)
Compare returns -1, 0, or +1 depending on whether
x < y, x == y, or x > y, interpreted as Go versions.
The versions x and y must begin with a "go" prefix: "go1.21" not "1.21".
Invalid versions, including the empty string, compare less than
valid versions and equal to each other.
The language version "go1.21" compares less than the
release candidate and eventual releases "go1.21rc1" and "go1.21.0".
IsValid reports whether the version x is valid.
Lang returns the Go language version for version x.
If x is not a valid version, Lang returns the empty string.
For example:
Lang("go1.21rc2") = "go1.21"
Lang("go1.21.2") = "go1.21"
Lang("go1.21") = "go1.21"
Lang("go1") = "go1"
Lang("bad") = ""
Lang("1.21") = ""
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |