From 0d23df70970361522c98e6a0c2709e44ece3de10 Mon Sep 17 00:00:00 2001 From: Philipp Dorschner Date: Wed, 20 Apr 2022 14:59:15 +0200 Subject: [PATCH 1/2] Fix return code --- cmd/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/query.go b/cmd/query.go index 864fe4f..fcbb952 100644 --- a/cmd/query.go +++ b/cmd/query.go @@ -61,7 +61,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query- rc = check.Critical } else if total >= cliQueryConfig.Warning { rc = check.Warning - } else if total == 0 { + } else if total >= 0 { rc = check.OK } From dc05856ebe823edb2c845702f127861d9719e6ed Mon Sep 17 00:00:00 2001 From: Philipp Dorschner Date: Wed, 20 Apr 2022 15:13:40 +0200 Subject: [PATCH 2/2] Fix lint SA4003: every value of type uint is >= 0 (staticcheck) --- .golangci.yml | 2 ++ cmd/query.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 823f5d7..be44421 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,6 +8,7 @@ linters: - dupl - whitespace - wsl + - exportloopref presets: - bugs - unused @@ -15,3 +16,4 @@ linters: disable: - gosec - funlen + - scopelint diff --git a/cmd/query.go b/cmd/query.go index fcbb952..22f8ce6 100644 --- a/cmd/query.go +++ b/cmd/query.go @@ -61,7 +61,7 @@ https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query- rc = check.Critical } else if total >= cliQueryConfig.Warning { rc = check.Warning - } else if total >= 0 { + } else if total < cliQueryConfig.Warning { rc = check.OK }