detect

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package detect provides functionality for detecting and managing platform-specific information, including the operating system, architecture, system library, file extension, and distribution. It offers utilities to parse platform details from strings, set default platform configurations, and merge platform data from different sources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Platform

type Platform struct {
	OS           platform.OS           // OS represents the operating system (e.g., Linux, Windows, macOS).
	Architecture platform.Architecture // Architecture defines the platform's CPU architecture and version.
	Library      platform.Library      // Library specifies the system library (e.g., GNU, Musl, MSVC).
	Extension    platform.Extension    // Extension represents the default file extension for executables.
	Distribution platform.Distribution // Distribution refers to the Linux distribution, if applicable.
}

Platform defines the characteristics of the platform, including OS, architecture, library, extension, and distribution.

func (*Platform) Detect

func (p *Platform) Detect() error

Detect gathers information about the current platform, such as the operating system, architecture, distribution, library, and file extension, and populates the Platform struct accordingly.

func (*Platform) Merge

func (p *Platform) Merge(other Platform)

Merge combines another Platform's fields into the current Platform, setting fields that are empty.

func (*Platform) Parse

func (p *Platform) Parse(name string)

Parse attempts to parse the platform's OS, architecture, and library from a given string.

func (Platform) ToMap

func (p Platform) ToMap() map[string]any

ToMap converts the Platform struct to a map for use in templates.

Directories

Path Synopsis
Package platform provides types and utilities for representing and working with different system platforms, including architectures, operating systems, libraries, and distributions.
Package platform provides types and utilities for representing and working with different system platforms, including architectures, operating systems, libraries, and distributions.

Jump to

Keyboard shortcuts

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