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

platform

package
v1.38.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package platform is where per-OS differences meet shared code. Shared files may read runtime.GOOS only as data; a branch on it belongs in a _linux.go, _darwin.go or _windows.go file. seams_test.go enforces that rule.

Index

Constants

This section is empty.

Variables

View Source
var Current = Caps{
	Opener:      "xdg-open",
	TrayHost:    !wsl.IsWSL(),
	WindowsSide: wsl.IsWSL(),
}

WSL is Linux to the compiler, so it is told apart here, once.

Functions

func LookPath

func LookPath(name string) (string, error)

LookPath finds a desktop program. Inside WSL that includes the Windows PATH, which a systemd service such as lerd-ui does not inherit.

func OpenCommand

func OpenCommand(target string) *exec.Cmd

OpenCommand hands target to the desktop's default app, nil when there is no opener. Inside WSL that desktop is Windows, reached through interop.

Types

type Caps

type Caps struct {
	// Opener hands a URL, file or folder to the desktop's default app; empty
	// where there is none.
	Opener string
	// UsesMachineVM: containers run inside a VM, so host unix sockets and file
	// events don't reach them and gvproxy forwards their ports.
	UsesMachineVM bool
	// NativePHPRuntime: PHP can run on the host instead of in a container.
	NativePHPRuntime bool
	// WorkerModes: workers can run through exec or in a container of their own.
	WorkerModes bool
	// TrayHost: the desktop can show lerd's own tray applet.
	TrayHost bool
	// WindowsSide: Linux inside WSL, with lerd.exe, its agent and the desktop app
	// on the Windows side to keep in step and to serve.
	WindowsSide bool
}

Caps are the facts about the host OS that shared code branches on. Each OS sets its own in a caps_<os>.go file as Current.

Jump to

Keyboard shortcuts

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