toolchain

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package toolchain provides compiler and version detection for binaries.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidVersionFormat = errors.New("invalid version format")
	ErrInvalidVersionMajor  = errors.New("invalid major version component")
	ErrInvalidVersionMinor  = errors.New("invalid minor version component")
)

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	BuildID  string
	Compiler Compiler
	Version  Version
}

BuildInfo contains compiler metadata extracted from a binary.

type Compiler

type Compiler string

Compiler identifies a compiler toolchain.

const (
	Unknown Compiler = ""
	GCC     Compiler = "gcc"
	Clang   Compiler = "clang"
	Rustc   Compiler = "rustc"
)

func (Compiler) String

func (c Compiler) String() string

type ELFCommentDetector

type ELFCommentDetector struct{}

ELFCommentDetector detects compiler from ELF .comment section.

func (ELFCommentDetector) Detect

func (ELFCommentDetector) Detect(comment string) (Compiler, Version)

type ELFDetector

type ELFDetector interface {
	Detect(comment string) (Compiler, Version)
}

ELFDetector detects compiler info from ELF binaries.

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a semantic version (major.minor.patch).

func ParseVersion

func ParseVersion(s string) (Version, error)

ParseVersion parses a version string like "1.2.3" or "1.2".

func (Version) IsAtLeast

func (v Version) IsAtLeast(required Version) bool

IsAtLeast reports whether v is at least the required version.

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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