Documentation
¶
Overview ¶
Package system provides OS-level utilities: environment/config loading, shell command execution, file checksums, and debugger detection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSum ¶
CheckSum calculates the SHA-256 hex digest of a multipart file, then resets the file pointer to the beginning.
func IsFileExists ¶
IsFileExists checks if a file exists and is not a directory.
func IsLaunchedByDebugger ¶
func IsLaunchedByDebugger() bool
IsLaunchedByDebugger checks if the current process was launched by the Delve debugger. Requires gops (https://github.com/google/gops) to be in PATH.
func LoadEnvs ¶
LoadEnvs loads environment variables from .env and .env.default files in the given directory.
func ReadConfig ¶
ReadConfig reads a YAML configuration file, selects the given environment section, and decodes it into the provided pointer using mapstructure.
Types ¶
type FileInfo ¶
type FileInfo struct {
Name string // Full file name with extension
BaseName string // File name without extension
Dir string // Directory path
Ext string // File extension including dot
}
FileInfo holds parsed components of a file path.
func GetFileInfo ¶
GetFileInfo splits a file path into its components.
type ShellCommandResult ¶
ShellCommandResult holds the output and exit code of a shell command.
func Exec ¶
func Exec(args ...string) (*ShellCommandResult, error)
Exec runs a shell command and returns the captured stdout, stderr, and exit code.
func (ShellCommandResult) GetError ¶
func (r ShellCommandResult) GetError() error
GetError returns stderr content as an error.
func (ShellCommandResult) HasError ¶
func (r ShellCommandResult) HasError() bool
HasError returns true if stderr contains output.