Documentation
¶
Overview ¶
Package platform provides access to platform information by graph actions and executing receivers.
Index ¶
Constants ¶
const ( Arch op.ActionName = "platform.arch" Distro op.ActionName = "platform.distro" Hostname op.ActionName = "platform.hostname" OS op.ActionName = "platform.os" Version op.ActionName = "platform.version" )
Action-name constants for the platform provider's plan-mode actions.
Each constant is the short dotted action label its method dispatches under. Pass these to plan.Plan, op.ReceiverRegistry().BuildAction, RuntimeEnvironment.ActionByName, or WithActionNamed in place of a string literal so a typo is a compile error and rename / find-references work through the constant.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
op.ProviderBase
}
Provider exposes host platform metadata to Starlark scripts and graph actions.
All accessors delegate to the platform capability (`platform.Platform`) on the provider's op.RuntimeEnvironment. When the context has no platform (nil), accessors return zero values.
func NewProvider ¶
func NewProvider(runtimeEnvironment *op.RuntimeEnvironment) *Provider
NewProvider returns a new platform Provider with the given runtime environment.
Parameters:
- `runtimeEnvironment`: the execution context (must carry a non-nil Platform for accessors to return data).
Returns:
- `*Provider`: the configured provider.
func (*Provider) Arch ¶
Arch returns the CPU architecture (e.g., "amd64", "arm64").
Returns:
- `string`: the architecture identifier, or "" if platform is nil.
+devlore:claim=deterministic
func (*Provider) Distro ¶
Distro returns the distribution as pkg/platform names it, lowercase: os-release's ID in pkg/platform's vocabulary ("ubuntu", "fedora"; linuxmint is "mint", centos is "centos-stream"), or, on a distribution pkg/platform doesn't list, the closest listed ancestor its os-release ID_LIKE names (#944); "macos" and "windows" off Linux.
Returns:
- `string`: the distribution, or "" if unavailable or platform is nil.
+devlore:claim=deterministic
func (*Provider) Hostname ¶
Hostname returns the machine hostname.
Returns:
- `string`: the hostname, or "" if unavailable or platform is nil.
+devlore:claim=deterministic