goversion

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package goversion decides which Go features the generated code may use, from the go directive of the project and the toolchain installed on the machine.

Index

Constants

View Source
const MinimumRelease = "1.26"

Variables

This section is empty.

Functions

func LatestVersion

func LatestVersion() string

func Max

func Max(a, b string) string

func NormalizeGoVersion

func NormalizeGoVersion(goversion string) (string, error)

func Supported

func Supported(goVersion string) bool

func UpgradeTarget

func UpgradeTarget(local string) string

UpgradeTarget picks the version to move a project to when its go directive is too old. We prefer the toolchain the user already has over the newest release, so nothing has to be downloaded just to build.

Types

type Capabilities

type Capabilities struct {
	Release string `json:"release"`
	StdUUID bool   `json:"stdUUID"`
	JSONv2  bool   `json:"jsonV2"`
}

func Known

func Known() []Capabilities

func Latest

func Latest() Capabilities

func (Capabilities) Enabled

func (c Capabilities) Enabled() []string

func (Capabilities) JSONImport

func (c Capabilities) JSONImport() string

func (Capabilities) String

func (c Capabilities) String() string

func (Capabilities) UUIDImport

func (c Capabilities) UUIDImport() string

type ModFile

type ModFile struct {
	Module    string
	Go        string
	Toolchain string
	File      *modfile.File
}

func ParseModFile

func ParseModFile(name string, data []byte) (*ModFile, error)

func (*ModFile) RequiredToolchain

func (m *ModFile) RequiredToolchain() string

func (*ModFile) Target

func (m *ModFile) Target() (Target, error)

type Status

type Status string
const (
	StatusSupported    Status = "supported"
	StatusBelowMinimum Status = "below_minimum"
	StatusAboveKnown   Status = "above_known"
)

type Target

type Target struct {
	GoVersion string       `json:"goVersion"`
	Toolchain string       `json:"toolchain,omitempty"`
	Status    Status       `json:"status"`
	Caps      Capabilities `json:"capabilities"`
	Warnings  []string     `json:"warnings,omitempty"`
}

func Resolve

func Resolve(goVersion string) (Target, error)

type Toolchain

type Toolchain struct {
	Local      string `json:"local"`
	Setting    string `json:"setting"`
	Experiment string `json:"experiment,omitempty"`
}

func DetectToolchain

func DetectToolchain(ctx context.Context) (Toolchain, error)

func (Toolchain) Check

func (tc Toolchain) Check(required string) ToolchainCheck

func (Toolchain) ExperimentWarning

func (tc Toolchain) ExperimentWarning(c Capabilities) string

type ToolchainCheck

type ToolchainCheck struct {
	OK       bool   `json:"ok"`
	Fatal    bool   `json:"fatal"`
	Required string `json:"required"`
	Message  string `json:"message,omitempty"`
}

type WorkFile

type WorkFile struct {
	Go        string
	Toolchain string
	Use       []string
}

func ParseWorkFile

func ParseWorkFile(name string, data []byte) (*WorkFile, error)

func (*WorkFile) RequiredToolchain

func (w *WorkFile) RequiredToolchain() string

Jump to

Keyboard shortcuts

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