diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-18 23:15:01 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-18 23:15:01 +0300 |
| commit | 88c7597a3bed54002b27570f7f36b945cffd47ad (patch) | |
| tree | b8b2b7ead6fbc7740f565ecb96e2c6bc00638085 | |
| parent | 3658638e3bb3edb0f266c65fe0e42a1cd53a5f83 (diff) | |
split into main and internal package"
| -rw-r--r-- | internal/check.go (renamed from check.go) | 2 | ||||
| -rw-r--r-- | internal/config.go (renamed from config.go) | 2 | ||||
| -rw-r--r-- | internal/execute.go (renamed from execute.go) | 2 | ||||
| -rw-r--r-- | internal/nagioscode.go (renamed from nagioscode.go) | 2 | ||||
| -rw-r--r-- | internal/notify.go (renamed from notify.go) | 2 | ||||
| -rw-r--r-- | internal/state.go (renamed from state.go) | 2 | ||||
| -rw-r--r-- | main.go | 30 |
7 files changed, 6 insertions, 36 deletions
diff --git a/check.go b/internal/check.go index 492bd98..44e878d 100644 --- a/check.go +++ b/internal/check.go @@ -1,4 +1,4 @@ -package main +package internal import ( "bytes" diff --git a/config.go b/internal/config.go index f54fabc..39e2209 100644 --- a/config.go +++ b/internal/config.go @@ -1,4 +1,4 @@ -package main +package internal import ( "encoding/json" diff --git a/execute.go b/internal/execute.go index 7461680..d8f426f 100644 --- a/execute.go +++ b/internal/execute.go @@ -1,4 +1,4 @@ -package main +package internal import ( "context" diff --git a/nagioscode.go b/internal/nagioscode.go index 8199aa1..b5dc892 100644 --- a/nagioscode.go +++ b/internal/nagioscode.go @@ -1,4 +1,4 @@ -package main +package internal type nagiosCode int diff --git a/notify.go b/internal/notify.go index e546549..7d8fc5a 100644 --- a/notify.go +++ b/internal/notify.go @@ -1,4 +1,4 @@ -package main +package internal import ( "fmt" diff --git a/state.go b/internal/state.go index 197024a..012bdf5 100644 --- a/state.go +++ b/internal/state.go @@ -1,4 +1,4 @@ -package main +package internal import ( "encoding/json" diff --git a/main.go b/main.go deleted file mode 100644 index 850c37a..0000000 --- a/main.go +++ /dev/null @@ -1,30 +0,0 @@ -package main - -import ( - "flag" -) - -func main() { - configFile := flag.String("cfg", "/etc/gogios.json", "The config file") - flag.Parse() - - config, err := newConfig(*configFile) - if err != nil { - panic(err) - } - - state, err := readState(config) - if err != nil { - notifyError(config, err) - } - - state = execute(state, config) - - if err := state.persist(); err != nil { - notifyError(config, err) - } - - if subject, body, changed := state.report(); changed { - notify(config, subject, body) - } -} |
