package versions
import "cuelang.org/go/internal/golangorgx/tools/versions"
Index ¶
- func Compare(x, y string) int
- func FileVersions(info *types.Info, file *ast.File) string
- func GoVersion(pkg *types.Package) string
- func InitFileVersions(info *types.Info)
- func IsValid(x string) bool
- func Lang(x string) string
Functions ¶
func Compare ¶
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". Custom toolchain suffixes are ignored during comparison: "go1.21.0" and "go1.21.0-bigcorp" are equal.
func FileVersions ¶
FileVersions maps a file to the file's semantic Go version. The reported version is the zero version if a version cannot be determined.
func GoVersion ¶
GoVersion returns the Go version of the type package. It returns zero if no version can be determined.
func InitFileVersions ¶
InitFileVersions initializes info to record Go versions for Go files.
func IsValid ¶
IsValid reports whether the version x is valid.
func Lang ¶
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") = ""
Source Files ¶
gover.go types.go types_go122.go versions.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 8 hours ago –
Tools for package owners.