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

serverutil

package
v1.24.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package serverutil holds the install and launch helpers shared by the browser IDE servers under pkg/ide.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChownIfNeeded

func ChownIfNeeded(userName, location string) error

ChownIfNeeded recursively hands location to userName. It is a no-op when userName is empty.

func PrepareLocation

func PrepareLocation(userName, dirName string) (string, error)

PrepareLocation returns <home>/<dirName> for userName, creating it if needed.

func SuOrSh

func SuOrSh(userName, runCommand, workingDir string) *exec.Cmd

SuOrSh builds an *exec.Cmd that runs runCommand either as the unprivileged user (via `su <user> -c`) or as the current user (via `sh -c`). All arg elements are constants from this package - runCommand itself is built from constants plus internal values, not user-controlled binary paths.

func UserHome

func UserHome(userName string) (string, error)

UserHome returns the home directory of userName, or of the current user when userName is empty.

Types

type ExtensionInstall

type ExtensionInstall struct {
	UserName   string
	Extensions []string
	// Command returns the shell command that installs one extension.
	Command func(extension string) string
	// Quote formats an extension name for log lines. Nil logs names as-is.
	Quote func(string) string
	// FailOnTotalFailure makes Run return an error when every extension fails.
	// Partial failures are always logged and tolerated.
	FailOnTotalFailure bool
}

ExtensionInstall runs one CLI install per extension, logging each outcome.

func (ExtensionInstall) Run

func (e ExtensionInstall) Run() error

Run installs each extension in order. Failures are logged and collected.

type ReleaseSpec

type ReleaseSpec struct {
	Options       ide.Options
	Amd64Option   string
	Arm64Option   string
	Amd64Template string
	Arm64Template string
}

ReleaseSpec describes how one IDE picks its server download URL per arch.

func (ReleaseSpec) URL

func (s ReleaseSpec) URL(values map[string]config.OptionValue, goarch string, args ...any) string

URL returns the value of the arch's override option when set, otherwise the arch's template filled with args. Any goarch other than "arm64" selects the amd64 settings.

Jump to

Keyboard shortcuts

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