diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-19 20:47:36 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-19 20:47:36 +0300 |
| commit | 396c173c53a014f6e8303931a0c100c08677647b (patch) | |
| tree | 855e3a313437b9fd2eec901d24af91b8ec1b6788 | |
| parent | 919cdfd15447846ee4d3acffb7570463897a7722 (diff) | |
rename execute to runChecks
| -rw-r--r-- | internal/check.go | 6 | ||||
| -rw-r--r-- | internal/run.go | 4 | ||||
| -rw-r--r-- | internal/runchecks.go (renamed from internal/execute.go) | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/internal/check.go b/internal/check.go index 44e878d..8a554ee 100644 --- a/internal/check.go +++ b/internal/check.go @@ -23,7 +23,7 @@ type checkResult struct { status nagiosCode } -func (c check) execute(ctx context.Context, name string) checkResult { +func (c check) run(ctx context.Context, name string) checkResult { cmd := exec.CommandContext(ctx, c.Plugin, c.Args...) var bytes bytes.Buffer @@ -43,6 +43,6 @@ func (c check) execute(ctx context.Context, name string) checkResult { return checkResult{name, output, nagiosCode(cmd.ProcessState.ExitCode())} } -func (c namedCheck) execute(ctx context.Context) checkResult { - return c.check.execute(ctx, c.name) +func (c namedCheck) run(ctx context.Context) checkResult { + return c.check.run(ctx, c.name) } diff --git a/internal/run.go b/internal/run.go index ef9919d..e647f7e 100644 --- a/internal/run.go +++ b/internal/run.go @@ -2,7 +2,7 @@ package internal import "context" -func Run(cts context.Context, configFile string) { +func Run(ctx context.Context, configFile string) { config, err := newConfig(configFile) if err != nil { panic(err) @@ -13,7 +13,7 @@ func Run(cts context.Context, configFile string) { notifyError(config, err) } - state = execute(ctx, state, config) + state = runChecks(ctx, state, config) if err := state.persist(); err != nil { notifyError(config, err) diff --git a/internal/execute.go b/internal/runchecks.go index 1029ff7..360a1b5 100644 --- a/internal/execute.go +++ b/internal/runchecks.go @@ -7,7 +7,7 @@ import ( "time" ) -func execute(globalCtx context.Context, state state, config config) state { +func runChecks(globalCtx context.Context, state state, config config) state { limiterCh := make(chan struct{}, config.CheckConcurrency) inputCh := make(chan namedCheck) outputCh := make(chan checkResult) @@ -44,7 +44,7 @@ func execute(globalCtx context.Context, state state, config config) state { time.Duration(config.CheckTimeoutS)*time.Second) defer cancel() - outputCh <- check.execute(ctx) + outputCh <- check.run(ctx) }(check) } |
