detect

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 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
	Library      platform.Library
	Distribution platform.Distribution
	Extension    platform.Extension
	Architecture platform.Architecture
}

Platform encapsulates system-specific characteristics and capabilities.

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) (changed bool)

Merge merges unset fields from other into p and reports whether anything changed.

func (*Platform) Parse

func (p *Platform) Parse() error

Parse extracts platform information from the configured fields.

func (*Platform) ParseFrom added in v0.0.13

func (p *Platform) ParseFrom(name string)

ParseFrom extracts platform information from a string identifier. Attempts to determine OS, architecture, and library details from the input.

func (*Platform) ToMap

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

ToMap converts the Platform configuration into a map for templating. Includes derived values like architecture type, version, and capability flags.

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