Documentation
¶
Index ¶
Examples ¶
Constants ¶
const ( // DefaultAPIAddr is the default HTTP listen address for the build API. DefaultAPIAddr = "127.0.0.1:9101" // DefaultHealthAddr is the default health probe address for daemon mode. DefaultHealthAddr = "127.0.0.1:9102" // DefaultWatchInterval is the file polling interval for auto-rebuilds. DefaultWatchInterval = 2 * time.Second // DefaultScheduleInterval is the cadence for periodic daemon jobs. DefaultScheduleInterval = time.Minute )
Variables ¶
This section is empty.
Functions ¶
func Export ¶
Export renders a native service definition for cfg.
Example ¶
--- v0.9.0 generated usage examples ---
_ = Export(Config{}, "tar.gz")
core.Println("Export")
Output: Export
func ResolveConfig ¶
ResolveConfig loads service defaults for the project in projectDir.
Example ¶
--- v0.9.0 generated usage examples ---
_ = ResolveConfig(core.Path(core.TempDir(), "go-build-compliance"))
core.Println("ResolveConfig")
Output: ResolveConfig
func ResolveNativeFormat ¶
ResolveNativeFormat maps an explicit format or the current platform to a native service type.
Example ¶
_ = ResolveNativeFormat("tar.gz")
core.Println("ResolveNativeFormat")
Output: ResolveNativeFormat
Types ¶
type Config ¶
type Config struct {
Name string
DisplayName string
Description string
ProjectDir string
WorkingDirectory string
Executable string
Arguments []string
Environment map[string]string
PIDFile string
APIAddr string
HealthAddr string
WatchPaths []string
WatchInterval time.Duration
ScheduleInterval time.Duration
AutoRebuild bool
}
Config describes the installed background service and daemon runtime.
func DefaultConfig ¶
DefaultConfig returns the default daemon and service manager settings.
Example ¶
_ = DefaultConfig(core.Path(core.TempDir(), "go-build-compliance"))
core.Println("DefaultConfig")
Output: DefaultConfig
func (Config) Normalized ¶
Normalized returns a copy of cfg with defaults, environment, and arguments applied.
Example ¶
subject := Config{}
_ = subject.Normalized()
core.Println("Config_Normalized")
Output: Config_Normalized
type ExportedConfig ¶
type ExportedConfig struct {
Format NativeFormat
Filename string
Content string
}
ExportedConfig is a generated native service definition.
type Manager ¶
type Manager interface {
Install(cfg Config) core.Result
Start(cfg Config) core.Result
Stop(cfg Config) core.Result
Uninstall(cfg Config) core.Result
}
Manager wraps OS service manager operations.
func NewManager ¶
func NewManager() Manager
NewManager returns the default OS service manager implementation.
Example ¶
--- v0.9.0 generated usage examples ---
_ = NewManager()
core.Println("NewManager")
Output: NewManager
type NativeFormat ¶
type NativeFormat string
NativeFormat identifies the native service definition to generate.
const ( NativeFormatSystemd NativeFormat = "systemd" NativeFormatLaunchd NativeFormat = "launchd" NativeFormatWindows NativeFormat = "windows" )
type OSManager ¶
type OSManager struct{}
OSManager uses github.com/kardianos/service to control native services.
func (*OSManager) Install ¶
Example ¶
subject := &OSManager{}
_ = subject.Install(Config{})
core.Println("OSManager_Install")
Output: OSManager_Install
func (*OSManager) Start ¶
Example ¶
subject := &OSManager{}
_ = subject.Start(Config{})
core.Println("OSManager_Start")
Output: OSManager_Start