From 0b1af49f2b913ea2848cef723818cf1835d22fc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Jun 2025 14:31:37 +0000 Subject: [PATCH 1/3] build(deps): bump golangci/golangci-lint-action from 7 to 8 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 7 to 8. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v7...v8) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index f7a7d44..df8441a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,6 +13,6 @@ jobs: - uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v7 + uses: golangci/golangci-lint-action@v8 with: version: v2.0.2 From 5d387a241e555a24ed88a5f329067913b9f3f302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Mon, 2 Jun 2025 10:12:09 +0200 Subject: [PATCH 2/3] Bump golang linter version in CI --- .github/workflows/golangci-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index df8441a..91555aa 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -15,4 +15,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v8 with: - version: v2.0.2 + version: v2.1.6 From 2365a5fbec9aeea7787180097965a3b0cf5370b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Mon, 2 Jun 2025 10:12:43 +0200 Subject: [PATCH 3/3] Fix linter warnings --- result/overall.go | 66 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/result/overall.go b/result/overall.go index 1a9994e..e822ef5 100644 --- a/result/overall.go +++ b/result/overall.go @@ -262,39 +262,6 @@ func (o *Overall) GetOutput() string { return output.String() } -// getPerfdata returns all subsequent perfdata as a concatenated string -func (s *PartialResult) getPerfdata() string { - var output strings.Builder - - if len(s.Perfdata) > 0 { - output.WriteString(s.Perfdata.String()) - } - - if s.PartialResults != nil { - for _, ss := range s.PartialResults { - output.WriteString(" " + ss.getPerfdata()) - } - } - - return strings.TrimSpace(output.String()) -} - -// getOutput generates indented output for all subsequent PartialResults -func (s *PartialResult) getOutput(indentLevel int) string { - var output strings.Builder - - prefix := strings.Repeat(" ", indentLevel) - output.WriteString(prefix + "\\_ " + s.String() + "\n") - - if s.PartialResults != nil { - for _, ss := range s.PartialResults { - output.WriteString(ss.getOutput(indentLevel + indentationOffset)) - } - } - - return output.String() -} - // SetDefaultState sets a new default state for a PartialResult func (s *PartialResult) SetDefaultState(state int) error { if state < check.OK || state > check.Unknown { @@ -342,3 +309,36 @@ func (s *PartialResult) GetStatus() int { return WorstState(states...) } + +// getPerfdata returns all subsequent perfdata as a concatenated string +func (s *PartialResult) getPerfdata() string { + var output strings.Builder + + if len(s.Perfdata) > 0 { + output.WriteString(s.Perfdata.String()) + } + + if s.PartialResults != nil { + for _, ss := range s.PartialResults { + output.WriteString(" " + ss.getPerfdata()) + } + } + + return strings.TrimSpace(output.String()) +} + +// getOutput generates indented output for all subsequent PartialResults +func (s *PartialResult) getOutput(indentLevel int) string { + var output strings.Builder + + prefix := strings.Repeat(" ", indentLevel) + output.WriteString(prefix + "\\_ " + s.String() + "\n") + + if s.PartialResults != nil { + for _, ss := range s.PartialResults { + output.WriteString(ss.getOutput(indentLevel + indentationOffset)) + } + } + + return output.String() +}