Help us shape the future of Go! Take the 2026 Go Developer Survey

platform

package
v0.2.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: 3 Imported by: 0

Documentation

Overview

Package platform translates between Go's runtime platform names, OCI platform strings, Docker buildx platform strings, and the labels used by the VS Code server downloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Platform

type Platform struct {
	OS      string // e.g. "linux"
	Arch    string // e.g. "amd64", "arm64", "arm"
	Variant string // e.g. "v7" for armhf
}

Platform identifies a target build platform.

func Current

func Current() Platform

Current returns the platform the current process is running on.

func Parse

func Parse(s string) (Platform, error)

Parse parses an OCI-style platform string like "linux/amd64" or "linux/arm/v7".

func (Platform) AlpineSuffix

func (p Platform) AlpineSuffix(alpine bool) string

AlpineSuffix is "-alpine" when the platform string carries that suffix, allowing distinct download variants. The devcontainer spec doesn't model libc explicitly, so callers typically derive this elsewhere.

func (Platform) String

func (p Platform) String() string

String returns the canonical OCI form (os/arch[/variant]).

func (Platform) VSCodeServerArch

func (p Platform) VSCodeServerArch() (string, error)

VSCodeServerArch maps a Platform to the architecture label VS Code uses for server downloads.

Reference: https://update.code.visualstudio.com/api/update/server-linux-<arch>/stable/<commit>

Jump to

Keyboard shortcuts

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