Documentation
¶
Index ¶
- Constants
- Variables
- func BatchKillExistBinaries(binaryPaths []string)
- func Build(binaries []string, pathOpts *PathOptions, buildOpt *BuildOptions)
- func CheckAndReportBinariesStatus()
- func CheckBinariesRunning() error
- func CheckBinariesStop() error
- func CheckProcessInMap(processMap map[string]int, processPath string) bool
- func CheckProcessNames(processPath string, expectedCount int, processMap map[string]int) error
- func CompileForPlatform(buildOpt *BuildOptions, platform string, compileBinaries []string)
- func DetectPlatform() string
- func EnsureRootRelPaths(paths ...string) (map[string]string, error)
- func ExportMageLauncherArchived(overrideMappingPaths map[string]string, exportOpt *ExportOptions) error
- func FetchProcesses() (map[string]int, error)
- func FindPIDsByBinaryPath() (map[string][]int, error)
- func GetAllRootFilesExcludeIgnore() ([]string, error)
- func GetBinFullPath(binName string) string
- func GetBinToolsFullPath(toolName string) string
- func GetDefaultExportMappingPaths(exclude []string) (map[string]string, error)
- func InitForSSC()
- func KillExistBinaries()
- func KillExistBinary(binaryPath string)
- func OsArch() string
- func PauseSpinner()
- func Print(opt PrintOptions) (int, error)
- func PrintBinaryPorts(binaryPath string, pidMap map[string][]int)
- func PrintBlue(message string) error
- func PrintBlueTwoLine(message string) error
- func PrintGreen(message string) error
- func PrintGreenNoTimeStamp(message string) error
- func PrintGreenToStdOut(a ...any) (int, error)
- func PrintGreenTwoLine(message string) error
- func PrintListenedPortsByBinaries() error
- func PrintRed(message string) error
- func PrintRedNoTimeStamp(message string) error
- func PrintRedToStdErr(a ...any) (int, error)
- func PrintYellow(message string) error
- func Protocol() error
- func RemoveOmitemptyFromFile(filePath string) error
- func ResumeSpinner()
- func RunWithPriority(priority PriorityLevel, env map[string]string, cmd string, args ...string) error
- func SetPriority(pid int, level PriorityLevel) error
- func StartBinaries(specificBinaries ...string) error
- func StartTools(specificTools ...string) error
- func StartToolsAndServices(binaries []string, pathOpts *PathOptions)
- func StopAndCheckBinaries()
- func StopBinaries()
- func StopSpinner()
- func UpdateGlobalPaths(opts *PathOptions) error
- func WithActiveSpinnerPaused(fn func())
- func WithSpinner(message string, fn func())
- func WithSpinnerE(message string, fn func() error) error
- type BuildOptions
- type Config
- type ExportOptions
- type PathConfig
- type PathOptions
- type PrintOptions
- type PriorityLevel
- type Spinner
Constants ¶
const ( ColorBlue = "\033[0;34m" ColorGreen = "\033[0;32m" ColorRed = "\033[0;31m" ColorYellow = "\033[33m" ColorMagenta = "\033[35m" ColorReset = "\033[0m" )
const ( MountConfigFilePath = "CONFIG_PATH" DeploymentType = "DEPLOYMENT_TYPE" KUBERNETES = "kubernetes" // Directory name constants ConfigDir = "config" OutputDir = "_output" SrcDir = "cmd" ToolsDir = "tools" TmpDir = "tmp" ExportDir = "export" LogsDir = "logs" BinDir = "bin" PlatformsDir = "platforms" )
Path constants
const (
ESCEraseLine = "\033[2K"
)
const (
StartConfigFile = "start-config.yml"
)
Variables ¶
var (
MaxFileDescriptors int
)
Functions ¶
func BatchKillExistBinaries ¶ added in v0.0.8
func BatchKillExistBinaries(binaryPaths []string)
func Build ¶ added in v0.0.13
func Build(binaries []string, pathOpts *PathOptions, buildOpt *BuildOptions)
func CheckAndReportBinariesStatus ¶
func CheckAndReportBinariesStatus()
func CheckBinariesRunning ¶
func CheckBinariesRunning() error
CheckBinariesRunning checks if all binary files are running as expected and returns any errors encountered.
func CheckBinariesStop ¶
func CheckBinariesStop() error
CheckBinariesStop checks if all binary files have stopped and returns an error if there are any binaries still running.
func CheckProcessInMap ¶ added in v0.0.9
func CheckProcessNames ¶
CheckProcessNames checks if the number of processes running that match the specified path equals the expected count.
func CompileForPlatform ¶
func CompileForPlatform(buildOpt *BuildOptions, platform string, compileBinaries []string)
func DetectPlatform ¶
func DetectPlatform() string
DetectPlatform detects the operating system and architecture.
func EnsureRootRelPaths ¶ added in v0.0.16
func ExportMageLauncherArchived ¶ added in v0.0.16
func ExportMageLauncherArchived(overrideMappingPaths map[string]string, exportOpt *ExportOptions) error
func FetchProcesses ¶ added in v0.0.9
FetchProcesses returns a map of executable paths to their running count.
func FindPIDsByBinaryPath ¶
FindPIDsByBinaryPath returns a map of executable paths to slices of PIDs.
func GetAllRootFilesExcludeIgnore ¶ added in v0.0.16
func GetBinFullPath ¶
Compatibility: maintain original global functions
func GetBinToolsFullPath ¶ added in v0.0.16
func GetDefaultExportMappingPaths ¶ added in v0.0.16
func InitForSSC ¶
func InitForSSC()
func KillExistBinaries ¶
func KillExistBinaries()
KillExistBinaries iterates over all binary files and kills their corresponding processes.
func KillExistBinary ¶
func KillExistBinary(binaryPath string)
KillExistBinary kills all processes matching the given binary file path.
func PauseSpinner ¶ added in v0.0.16
func PauseSpinner()
func Print ¶ added in v0.0.16
func Print(opt PrintOptions) (int, error)
func PrintBinaryPorts ¶
func PrintBlueTwoLine ¶
func PrintGreen ¶
func PrintGreenNoTimeStamp ¶
func PrintGreenToStdOut ¶
func PrintGreenTwoLine ¶
func PrintListenedPortsByBinaries ¶
func PrintListenedPortsByBinaries() error
PrintListenedPortsByBinaries iterates over all binary files and prints the ports they are listening on.
func PrintRedNoTimeStamp ¶
func PrintRedToStdErr ¶
func PrintYellow ¶ added in v0.0.4
func RemoveOmitemptyFromFile ¶ added in v0.0.14
func ResumeSpinner ¶ added in v0.0.16
func ResumeSpinner()
func RunWithPriority ¶ added in v0.0.16
func SetPriority ¶ added in v0.0.16
func SetPriority(pid int, level PriorityLevel) error
func StartBinaries ¶
StartBinaries Start all binary services or specified ones.
func StartTools ¶
StartTools starts all tool binaries or specified ones.
func StartToolsAndServices ¶
func StartToolsAndServices(binaries []string, pathOpts *PathOptions)
func StopAndCheckBinaries ¶
func StopAndCheckBinaries()
func StopBinaries ¶
func StopBinaries()
StopBinaries iterates over all binary files and terminates their corresponding processes.
func StopSpinner ¶ added in v0.0.16
func StopSpinner()
func UpdateGlobalPaths ¶ added in v0.0.16
func UpdateGlobalPaths(opts *PathOptions) error
UpdateGlobalPaths updates the global Paths variable with new options
func WithActiveSpinnerPaused ¶ added in v0.0.16
func WithActiveSpinnerPaused(fn func())
func WithSpinner ¶ added in v0.0.16
func WithSpinner(message string, fn func())
func WithSpinnerE ¶ added in v0.0.16
Types ¶
type BuildOptions ¶ added in v0.0.16
func ResolveBuildOptions ¶ added in v0.0.16
func ResolveBuildOptions(codeOpt *BuildOptions, envOpt *BuildOptions) *BuildOptions
func (*BuildOptions) GetCgoEnabled ¶ added in v0.0.16
func (opt *BuildOptions) GetCgoEnabled() string
func (*BuildOptions) GetCompress ¶ added in v0.0.16
func (opt *BuildOptions) GetCompress() bool
func (*BuildOptions) GetPlatforms ¶ added in v0.0.16
func (opt *BuildOptions) GetPlatforms() []string
func (*BuildOptions) GetRelease ¶ added in v0.0.16
func (opt *BuildOptions) GetRelease() bool
type ExportOptions ¶ added in v0.0.16
type ExportOptions struct {
ProjectName *string
BuildOpt *BuildOptions
}
func (*ExportOptions) GetBuildOpt ¶ added in v0.0.16
func (opt *ExportOptions) GetBuildOpt() *BuildOptions
func (*ExportOptions) GetProjectName ¶ added in v0.0.16
func (opt *ExportOptions) GetProjectName() string
type PathConfig ¶ added in v0.0.16
type PathConfig struct {
Root string
Config string
K8sConfig string
Output string
OutputTools string
OutputTmp string
OutputExport string
OutputLogs string
OutputBin string
OutputBinPath string
OutputBinToolPath string
OutputHostBin string
OutputHostBinTools string
SrcDir string // Source cmd directory
ToolsDir string // Source tools directory
}
PathConfig represents the path configuration structure
var Paths *PathConfig
func NewPathConfig ¶ added in v0.0.16
func NewPathConfig(opts *PathOptions) (*PathConfig, error)
NewPathConfig creates a new path configuration with optional settings
func (*PathConfig) GetBinFullPath ¶ added in v0.0.16
func (p *PathConfig) GetBinFullPath(binName string) string
GetBinFullPath returns the full path for a binary file
func (*PathConfig) GetBinToolsFullPath ¶ added in v0.0.16
func (p *PathConfig) GetBinToolsFullPath(toolName string) string
GetToolFullPath returns the full path for a tool
type PathOptions ¶ added in v0.0.16
type PathOptions struct {
RootDir *string // Custom root directory, default is current working directory(./)
OutputDir *string // Custom output directory name, default is "_output"
ConfigDir *string // Custom config directory name, default is "config"
SrcDir *string // Custom cmd source directory name, default is "cmd"
ToolsDir *string // Custom tools source directory name, default is "tools"
}
type PrintOptions ¶ added in v0.0.16
type PriorityLevel ¶ added in v0.0.16
type PriorityLevel int
const ( PriorityLow PriorityLevel = iota PriorityBelowNormal PriorityNormal PriorityHigh )