diff options
author | Julien Dessaux | 2021-04-23 16:51:22 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-04-23 16:51:22 +0200 |
commit | 38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8 (patch) | |
tree | d3f7167fae6388f4db35a63e660d1816c9c2943e | |
parent | Fixed wrongfully hardcoded path in tests. (diff) | |
download | bareos-zabbix-check-38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8.tar.gz bareos-zabbix-check-38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8.tar.bz2 bareos-zabbix-check-38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8.zip |
Updated for go 1.16 modules1.2
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | cmd/bareos-zabbix-check/main.go (renamed from main.go) | 3 | ||||
-rw-r--r-- | go.mod | 4 | ||||
-rw-r--r-- | pkg/job/job.go (renamed from job/job.go) | 0 | ||||
-rw-r--r-- | pkg/job/job_test.go (renamed from job/job_test.go) | 0 | ||||
-rw-r--r-- | pkg/job/utils.go (renamed from job/utils.go) | 0 | ||||
-rw-r--r-- | pkg/job/utils_test.go (renamed from job/utils_test.go) | 0 | ||||
-rw-r--r-- | pkg/spool/parse.go (renamed from spool/parse.go) | 2 | ||||
-rw-r--r-- | pkg/spool/parse_test.go (renamed from spool/parse_test.go) | 3 | ||||
-rw-r--r-- | pkg/spool/serialize.go (renamed from spool/serialize.go) | 3 | ||||
-rw-r--r-- | pkg/spool/serialize_test.go (renamed from spool/serialize_test.go) | 3 | ||||
-rw-r--r-- | pkg/state/header.go (renamed from state/header.go) | 2 | ||||
-rw-r--r-- | pkg/state/header_test.go (renamed from state/header_test.go) | 0 | ||||
-rw-r--r-- | pkg/state/job.go (renamed from state/job.go) | 4 | ||||
-rw-r--r-- | pkg/state/job_test.go (renamed from state/job_test.go) | 3 | ||||
-rw-r--r-- | pkg/utils/clen.go (renamed from utils/clen.go) | 0 | ||||
-rw-r--r-- | pkg/utils/clen_test.go (renamed from utils/clen_test.go) | 0 | ||||
-rw-r--r-- | pkg/zabbix/flags.go (renamed from zabbix/flags.go) | 0 | ||||
-rw-r--r-- | pkg/zabbix/statefile.go (renamed from zabbix/statefile.go) | 0 | ||||
-rw-r--r-- | pkg/zabbix/testdata/bareos-fd-17.2.state (renamed from zabbix/testdata/bareos-fd-17.2.state) | bin | 2196 -> 2196 bytes | |||
-rw-r--r-- | pkg/zabbix/testdata/bareos-fd-18.2.state (renamed from zabbix/testdata/bareos-fd-18.2.state) | bin | 2196 -> 2196 bytes | |||
-rw-r--r-- | pkg/zabbix/testdata/bareos-fd-18.2.state-with-error (renamed from zabbix/testdata/bareos-fd-18.2.state-with-error) | bin | 2196 -> 2196 bytes | |||
-rw-r--r-- | pkg/zabbix/workdir.go (renamed from zabbix/workdir.go) | 0 | ||||
-rw-r--r-- | pkg/zabbix/zabbix.go (renamed from zabbix/main.go) | 7 | ||||
-rw-r--r-- | pkg/zabbix/zabbix_test.go (renamed from zabbix/main_test.go) | 4 |
25 files changed, 25 insertions, 19 deletions
@@ -15,7 +15,7 @@ This program was born from a need to query the status of the backups from the cl ## Dependencies -go is required. Only go version >= 1.13.5 on linux amd64 has been tested. +go is required. Only go version >= 1.16 on linux amd64 has been tested. ## Building @@ -26,12 +26,12 @@ go test -cover ./... For a debug build, use : ``` -go build +go build ./cmd/bareos-zabbix-check/ ``` For a release build, use : ``` -go build -ldflags="-s -w" +go build -ldflags="-s -w" ./cmd/bareos-zabbix-check/ ``` ## Usage diff --git a/main.go b/cmd/bareos-zabbix-check/main.go index f55943d..b695119 100644 --- a/main.go +++ b/cmd/bareos-zabbix-check/main.go @@ -3,8 +3,9 @@ package main import ( - "bareos-zabbix-check/zabbix" "fmt" + + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/zabbix" ) func main() { @@ -1,5 +1,5 @@ -module bareos-zabbix-check +module git.adyxax.org/adyxax/bareos-zabbix-check -go 1.13 +go 1.16 require github.com/pkg/errors v0.9.1 diff --git a/job/job.go b/pkg/job/job.go index 4241844..4241844 100644 --- a/job/job.go +++ b/pkg/job/job.go diff --git a/job/job_test.go b/pkg/job/job_test.go index cb50e31..cb50e31 100644 --- a/job/job_test.go +++ b/pkg/job/job_test.go diff --git a/job/utils.go b/pkg/job/utils.go index 6537474..6537474 100644 --- a/job/utils.go +++ b/pkg/job/utils.go diff --git a/job/utils_test.go b/pkg/job/utils_test.go index 250ae2c..250ae2c 100644 --- a/job/utils_test.go +++ b/pkg/job/utils_test.go diff --git a/spool/parse.go b/pkg/spool/parse.go index 5695890..fc378f3 100644 --- a/spool/parse.go +++ b/pkg/spool/parse.go @@ -1,11 +1,11 @@ package spool import ( - "bareos-zabbix-check/job" "encoding/csv" "io" "strconv" + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" "github.com/pkg/errors" ) diff --git a/spool/parse_test.go b/pkg/spool/parse_test.go index 80b961f..cfbb050 100644 --- a/spool/parse_test.go +++ b/pkg/spool/parse_test.go @@ -1,12 +1,13 @@ package spool import ( - "bareos-zabbix-check/job" "bytes" "io" "reflect" "testing" "testing/iotest" + + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" ) func TestParse(t *testing.T) { diff --git a/spool/serialize.go b/pkg/spool/serialize.go index 04af8da..bfa7729 100644 --- a/spool/serialize.go +++ b/pkg/spool/serialize.go @@ -1,10 +1,11 @@ package spool import ( - "bareos-zabbix-check/job" "encoding/csv" "fmt" "io" + + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" ) // Serialize writes a spool on the disk diff --git a/spool/serialize_test.go b/pkg/spool/serialize_test.go index 896125c..7337121 100644 --- a/spool/serialize_test.go +++ b/pkg/spool/serialize_test.go @@ -1,9 +1,10 @@ package spool import ( - "bareos-zabbix-check/job" "bytes" "testing" + + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" ) func TestSerialize(t *testing.T) { diff --git a/state/header.go b/pkg/state/header.go index 3becd5d..ee6629b 100644 --- a/state/header.go +++ b/pkg/state/header.go @@ -1,12 +1,12 @@ package state import ( - "bareos-zabbix-check/utils" "bytes" "encoding/binary" "fmt" "io" + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/utils" "github.com/pkg/errors" ) diff --git a/state/header_test.go b/pkg/state/header_test.go index 1ed71eb..1ed71eb 100644 --- a/state/header_test.go +++ b/pkg/state/header_test.go diff --git a/state/job.go b/pkg/state/job.go index e8333ff..e86bc8e 100644 --- a/state/job.go +++ b/pkg/state/job.go @@ -1,8 +1,6 @@ package state import ( - "bareos-zabbix-check/job" - "bareos-zabbix-check/utils" "bytes" "encoding/binary" "fmt" @@ -10,6 +8,8 @@ import ( "regexp" "time" + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/utils" "github.com/pkg/errors" ) diff --git a/state/job_test.go b/pkg/state/job_test.go index 410401b..f814574 100644 --- a/state/job_test.go +++ b/pkg/state/job_test.go @@ -1,11 +1,12 @@ package state import ( - "bareos-zabbix-check/job" "bytes" "io" "reflect" "testing" + + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" ) func Test_jobEntry_String(t *testing.T) { diff --git a/utils/clen.go b/pkg/utils/clen.go index 17d1c4b..17d1c4b 100644 --- a/utils/clen.go +++ b/pkg/utils/clen.go diff --git a/utils/clen_test.go b/pkg/utils/clen_test.go index 19361b0..19361b0 100644 --- a/utils/clen_test.go +++ b/pkg/utils/clen_test.go diff --git a/zabbix/flags.go b/pkg/zabbix/flags.go index 3e95321..3e95321 100644 --- a/zabbix/flags.go +++ b/pkg/zabbix/flags.go diff --git a/zabbix/statefile.go b/pkg/zabbix/statefile.go index 26ea650..26ea650 100644 --- a/zabbix/statefile.go +++ b/pkg/zabbix/statefile.go diff --git a/zabbix/testdata/bareos-fd-17.2.state b/pkg/zabbix/testdata/bareos-fd-17.2.state Binary files differindex e98786c..e98786c 100644 --- a/zabbix/testdata/bareos-fd-17.2.state +++ b/pkg/zabbix/testdata/bareos-fd-17.2.state diff --git a/zabbix/testdata/bareos-fd-18.2.state b/pkg/zabbix/testdata/bareos-fd-18.2.state Binary files differindex ca1f30c..ca1f30c 100644 --- a/zabbix/testdata/bareos-fd-18.2.state +++ b/pkg/zabbix/testdata/bareos-fd-18.2.state diff --git a/zabbix/testdata/bareos-fd-18.2.state-with-error b/pkg/zabbix/testdata/bareos-fd-18.2.state-with-error Binary files differindex 3d28356..3d28356 100644 --- a/zabbix/testdata/bareos-fd-18.2.state-with-error +++ b/pkg/zabbix/testdata/bareos-fd-18.2.state-with-error diff --git a/zabbix/workdir.go b/pkg/zabbix/workdir.go index 287c80a..287c80a 100644 --- a/zabbix/workdir.go +++ b/pkg/zabbix/workdir.go diff --git a/zabbix/main.go b/pkg/zabbix/zabbix.go index 576fc17..77fef6d 100644 --- a/zabbix/main.go +++ b/pkg/zabbix/zabbix.go @@ -1,13 +1,14 @@ package zabbix import ( - "bareos-zabbix-check/job" - "bareos-zabbix-check/spool" - "bareos-zabbix-check/state" "fmt" "os" "path/filepath" "time" + + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/job" + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/spool" + "git.adyxax.org/adyxax/bareos-zabbix-check/pkg/state" ) const ( diff --git a/zabbix/main_test.go b/pkg/zabbix/zabbix_test.go index ca722f6..d623d41 100644 --- a/zabbix/main_test.go +++ b/pkg/zabbix/zabbix_test.go @@ -37,9 +37,9 @@ func TestMain(t *testing.T) { {"failed bacula_auto_detect", 0, "tmp/bacula_auto_detect_failed", []string{}, "INFO Failed to init programm : Could not find a suitable state file. Has a job ever run?"}, {"failed bareos_auto_detect", 0, "tmp/bareos_auto_detect_failed", []string{}, "INFO Failed to init programm : Could not find a suitable state file. Has a job ever run?"}, {"failed auto_detect", 0, "tmp/non_existent", []string{}, "INFO Failed to init programm : Could not find a suitable work directory. Is bareos or bacula installed?"}, - {"no work directory", 0, "tmp", []string{"-w", "/non_existent"}, fmt.Sprintf("INFO Failed to init programm : Invalid work directory %s/zabbix/tmp/non_existent : it does not exist or is not a directory", wd)}, + {"no work directory", 0, "tmp", []string{"-w", "/non_existent"}, fmt.Sprintf("INFO Failed to init programm : Invalid work directory %s/tmp/non_existent : it does not exist or is not a directory", wd)}, {"no state file auto_detect", 0, "tmp", []string{"-w", "/no_state_file"}, "INFO Failed to init programm : Could not find a suitable state file. Has a job ever run?"}, - {"no state file", 0, "tmp", []string{"-w", "/no_state_file", "-f", "test"}, fmt.Sprintf("INFO Failed to init programm : The state file %s/zabbix/tmp/no_state_file/test does not exist", wd}, + {"no state file", 0, "tmp", []string{"-w", "/no_state_file", "-f", "test"}, fmt.Sprintf("INFO Failed to init programm : The state file %s/tmp/no_state_file/test does not exist", wd)}, {"ok bareos 18.2", 1582579731, "tmp/ok-18.2", []string{"-w", "/", "-f", "state"}, "OK"}, {"ok bareos 17.2", 1582579731, "tmp/ok-17.2", []string{"-w", "/", "-f", "state"}, "OK"}, {"missing", 1582709331, "tmp/ok-18.2", []string{"-w", "/", "-f", "state"}, "AVERAGE: missing: awhphpipam1_percona_xtrabackup, awhphpipam1_LinuxAll, awhphpipam1_www"}, |