version

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

versionパッケージは、Goツールチェーン名の構文 のような文字列、 つまり "go1.20"、"go1.21.0"、"go1.22rc2"、"go1.23.4-bigcorp"などの Goバージョン に対する操作を提供します。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(x, y string) int

Compareは、x < y、x == y、またはx > yの場合にそれぞれ-1、0、または+1を返します。 これはGoのバージョンとして解釈されます。 バージョンxとyは"go"プレフィックスで始まる必要があります:"go1.21"であり、"1.21"ではありません。 無効なバージョン、空文字列を含む、は有効なバージョンよりも小さく、 お互いに等しいと比較されます。 言語バージョン"go1.21"はリリース候補および最終リリース"go1.21rc1"および"go1.21.0"よりも小さいと比較されます。

func IsValid

func IsValid(x string) bool

IsValidは、バージョンxが有効かどうかを報告します。

func Lang

func Lang(x string) string

Langは、バージョンxのGo言語バージョンを返します。 もしxが有効なバージョンでない場合、Langは空の文字列を返します。 例えば:

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