versions

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(x, y string) int

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

func FileVersions(info *types.Info, file *ast.File) string

FileVersions always reports the a file's Go version as the zero version at this Go version.

func GoVersion

func GoVersion(pkg *types.Package) string

GoVersion returns the Go version of the type package. It returns zero if no version can be determined.

func InitFileVersions

func InitFileVersions(*types.Info)

InitFileVersions is a noop at this Go version.

func IsValid

func IsValid(x string) bool

IsValid reports whether the version x is valid.

func Lang

func Lang(x string) string

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") = ""

Types

This section is empty.

Jump to

Keyboard shortcuts

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