platform

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasDockerSocket added in v1.2.0

func HasDockerSocket() bool

HasDockerSocket checks common Docker socket locations for macOS runtimes.

func IsDarwin

func IsDarwin() bool

IsDarwin returns true if running on macOS

func IsLinux

func IsLinux() bool

IsLinux returns true if running on Linux

func IsWindows

func IsWindows() bool

IsWindows returns true if running on Windows

func MacOSMajorVersion added in v1.2.0

func MacOSMajorVersion() int

MacOSMajorVersion returns 0 on non-macOS platforms.

func NormalizeName added in v1.1.7

func NormalizeName(name string) string

NormalizeName normalizes a string to be a valid folder name - Converts to lowercase - Replaces spaces and special chars with hyphens - Removes consecutive hyphens - Trims leading/trailing hyphens

Types

type Paths

type Paths struct {
	// contains filtered or unexported fields
}

Paths provides cross-platform path resolution for ggo

func DefaultPaths

func DefaultPaths() *Paths

DefaultPaths returns the default paths for the current platform All paths are stored in the user directory (~/.gpugo)

func (*Paths) AgentPIDFile

func (p *Paths) AgentPIDFile() string

AgentPIDFile returns the path to the agent PID file All platforms: ~/.gpugo/state/agent.pid (or StateDir/agent.pid)

func (*Paths) BinDir

func (p *Paths) BinDir() string

BinDir returns the directory for binaries All platforms: ~/.gpugo/bin (or UserDir/bin)

func (*Paths) CacheDir

func (p *Paths) CacheDir() string

CacheDir returns the cache directory for downloaded files All platforms: ~/.gpugo/cache (or UserDir/cache)

func (*Paths) ConfigDir

func (p *Paths) ConfigDir() string

ConfigDir returns the configuration directory All platforms: ~/.gpugo/config (or UserDir/config)

func (*Paths) ConnectionsDir added in v1.1.6

func (p *Paths) ConnectionsDir() string

ConnectionsDir returns the directory for worker connection files Each worker writes its connections to a separate file: {workerID}.txt All platforms: ~/.gpugo/state/connections (or StateDir/connections)

func (*Paths) CurrentOSConfigDir added in v1.1.7

func (p *Paths) CurrentOSConfigDir() string

CurrentOSConfigDir returns the config directory for the current OS (used by ggo use) All platforms: ~/.gpugo/studio/current-os/config

func (*Paths) CurrentOSLogsDir added in v1.1.7

func (p *Paths) CurrentOSLogsDir() string

CurrentOSLogsDir returns the logs directory for the current OS (used by ggo use) All platforms: ~/.gpugo/studio/current-os/logs

func (*Paths) EnsureAllDirs

func (p *Paths) EnsureAllDirs() error

EnsureAllDirs creates all required directories

func (*Paths) EnsureStudioDirs added in v1.1.7

func (p *Paths) EnsureStudioDirs(name string) error

EnsureStudioDirs creates all required directories for a studio

func (*Paths) GlobPattern

func (p *Paths) GlobPattern(prefix string) string

GlobPattern returns the platform-appropriate glob pattern for temp cleanup

func (*Paths) LDSoConfPath added in v1.1.7

func (p *Paths) LDSoConfPath(name string) string

LDSoConfPath returns the path to the ld.so.conf.d file for a studio This file will be mounted to /etc/ld.so.conf.d/zz_tensor-fusion.conf in containers

func (*Paths) LDSoPreloadPath added in v1.1.7

func (p *Paths) LDSoPreloadPath(name string) string

LDSoPreloadPath returns the path to the ld.so.preload file for a studio This file will be mounted to /etc/ld.so.preload in containers

func (*Paths) LibDir

func (p *Paths) LibDir() string

LibDir returns the directory for shared libraries All platforms: ~/.gpugo/lib (or UserDir/lib)

func (*Paths) LibsDir added in v1.1.18

func (p *Paths) LibsDir() string

LibsDir returns the directory for downloaded .so/.dll library files This is separate from CacheDir which contains all downloaded files (including binaries) The libs directory is used for LD_LIBRARY_PATH, ld.so.conf, and ld.so.preload All platforms: ~/.gpugo/cache/libs (or CacheDir/libs) Used by agent/worker which always runs on the native host architecture.

func (*Paths) LibsDirForPlatform added in v1.5.0

func (p *Paths) LibsDirForPlatform(targetOS, arch string) string

LibsDirForPlatform returns the arch-specific libs directory for a given OS and architecture. This is used by studio/use/launch which may download libraries for a different platform (e.g., linux/amd64 libs on an arm64 Mac). Layout: ~/.gpugo/cache/libs/{os}-{arch} (e.g., ~/.gpugo/cache/libs/linux-amd64)

func (*Paths) StateDir

func (p *Paths) StateDir() string

StateDir returns the state directory for runtime data All platforms: ~/.gpugo/state (or UserDir/state)

func (*Paths) StudioConfigDir added in v1.1.7

func (p *Paths) StudioConfigDir(name string) string

StudioConfigDir returns the config directory for a specific studio Used for storing ld.so.preload and ld.so.conf content for the studio All platforms: ~/.gpugo/studio/{name}/config

func (*Paths) StudioDir added in v1.1.7

func (p *Paths) StudioDir() string

StudioDir returns the directory for studio configurations All platforms: ~/.gpugo/studio (or UserDir/studio)

func (*Paths) StudioLogFilePath added in v1.4.1

func (p *Paths) StudioLogFilePath(name string) string

StudioLogFilePath returns the path to the daily log file for a studio Format: ~/.gpugo/studio/{name}/logs/logs-YYYY-mm-dd.txt Caller must ensure the parent directory exists (e.g. via EnsureStudioDirs or MkdirAll on StudioLogsDir)

func (*Paths) StudioLogsDir added in v1.1.7

func (p *Paths) StudioLogsDir(name string) string

StudioLogsDir returns the logs directory for a specific studio name: the normalized studio name (use NormalizeName to sanitize) All platforms: ~/.gpugo/studio/{name}/logs

func (*Paths) TempDir

func (p *Paths) TempDir() string

TempDir returns a platform-appropriate temporary directory

func (*Paths) UserDir

func (p *Paths) UserDir() string

UserDir returns the user-specific directory - Linux: ~/.gpugo - macOS: ~/.gpugo - Windows: %USERPROFILE%\.gpugo

func (*Paths) WithConfigDir

func (p *Paths) WithConfigDir(dir string) *Paths

WithConfigDir returns a new Paths with a custom config directory

func (*Paths) WithStateDir

func (p *Paths) WithStateDir(dir string) *Paths

WithStateDir returns a new Paths with a custom state directory

Jump to

Keyboard shortcuts

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