From 0d7edf10184c148d57f2142e326beaa144a6c11b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:40:10 +0000 Subject: [PATCH] Go Dependency: Bump github.com/atc0005/go-nagios from 0.16.1 to 0.16.2 Bumps [github.com/atc0005/go-nagios](https://github.com/atc0005/go-nagios) from 0.16.1 to 0.16.2. - [Release notes](https://github.com/atc0005/go-nagios/releases) - [Changelog](https://github.com/atc0005/go-nagios/blob/master/CHANGELOG.md) - [Commits](https://github.com/atc0005/go-nagios/compare/v0.16.1...v0.16.2) --- updated-dependencies: - dependency-name: github.com/atc0005/go-nagios dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 6 ++-- .../atc0005/go-nagios/.golangci.yml | 1 - .../github.com/atc0005/go-nagios/CHANGELOG.md | 25 +++++++++++++- vendor/github.com/atc0005/go-nagios/README.md | 7 ++-- vendor/github.com/atc0005/go-nagios/nagios.go | 19 +++++++++-- .../github.com/atc0005/go-nagios/perfdata.go | 34 +++++++++---------- .../github.com/atc0005/go-nagios/sections.go | 26 +++++++------- vendor/modules.txt | 2 +- 9 files changed, 78 insertions(+), 44 deletions(-) diff --git a/go.mod b/go.mod index 91a52b97..eebc6c3a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/atc0005/check-mail go 1.19 require ( - github.com/atc0005/go-nagios v0.16.1 + github.com/atc0005/go-nagios v0.16.2 github.com/emersion/go-imap v1.2.1 github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 github.com/google/go-cmp v0.6.0 diff --git a/go.sum b/go.sum index 058229f4..500c4e33 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/atc0005/go-nagios v0.16.1 h1:ef0AWjY9sqWq6dhfJuXtASe7dCkVDonoZhtYvNYWBlo= -github.com/atc0005/go-nagios v0.16.1/go.mod h1:NSm1HeneeyBe27BYzhC7FMx4gg3x8PddeZIMX9YZj5M= +github.com/atc0005/go-nagios v0.16.2 h1:yl11RiT1PrxQ/z1XrjhMWPpXt+ztn7NBElkjTd/nKx0= +github.com/atc0005/go-nagios v0.16.2/go.mod h1:n2RHhsrgI8xiapqkJ240dKLwMXWbWvkOPLE92x0IGaM= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/emersion/go-imap v1.2.1 h1:+s9ZjMEjOB8NzZMVTM3cCenz2JrQIGGo5j1df19WjTA= @@ -25,7 +25,7 @@ github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/sqs/go-xoauth2 v0.0.0-20120917012134-0911dad68e56 h1:KCgKdj+ha4CgnVHIiJYGKzgZk3HfCc6XssESfOa6atM= github.com/sqs/go-xoauth2 v0.0.0-20120917012134-0911dad68e56/go.mod h1:ghDEBrT4oFcM4rv18bzcZaAWXbHPGpDa4e2hh9oXL8A= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/atc0005/go-nagios/.golangci.yml b/vendor/github.com/atc0005/go-nagios/.golangci.yml index 28e1d931..d9835ffb 100644 --- a/vendor/github.com/atc0005/go-nagios/.golangci.yml +++ b/vendor/github.com/atc0005/go-nagios/.golangci.yml @@ -27,7 +27,6 @@ linters: - goimports - gosec - govet - - maligned - misspell - prealloc - revive diff --git a/vendor/github.com/atc0005/go-nagios/CHANGELOG.md b/vendor/github.com/atc0005/go-nagios/CHANGELOG.md index 1419ee5b..98a2762a 100644 --- a/vendor/github.com/atc0005/go-nagios/CHANGELOG.md +++ b/vendor/github.com/atc0005/go-nagios/CHANGELOG.md @@ -26,6 +26,28 @@ The following types of changes will be recorded in this file: - placeholder +## [v0.16.2] - 2024-10-10 + +### Changed + +#### Dependency Updates + +- (GH-240) Update Dependabot PR prefixes +- (GH-241) Update Dependabot PR prefixes (redux) +- (GH-242) Go Dependency: Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 + +#### Other + +- (GH-245) Add check_cert plugin perfdata success test case +- (GH-254) Update README reference links + +### Fixed + +- (GH-247) Remove inactive maligned linter +- (GH-248) Fix errcheck linting errors +- (GH-252) Fix `TestEmptyServiceOutputProducesNoOutput` test +- (GH-257) Fix `predeclared` linter warnings + ## [v0.16.1] - 2024-01-25 ### Added @@ -521,7 +543,8 @@ Initial package state - Nagios state map -[Unreleased]: https://github.com/atc0005/go-nagios/compare/v0.16.1...HEAD +[Unreleased]: https://github.com/atc0005/go-nagios/compare/v0.16.2...HEAD +[v0.16.2]: https://github.com/atc0005/go-nagios/releases/tag/v0.16.2 [v0.16.1]: https://github.com/atc0005/go-nagios/releases/tag/v0.16.1 [v0.16.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.16.0 [v0.15.0]: https://github.com/atc0005/go-nagios/releases/tag/v0.15.0 diff --git a/vendor/github.com/atc0005/go-nagios/README.md b/vendor/github.com/atc0005/go-nagios/README.md index 76d92773..1b35534c 100644 --- a/vendor/github.com/atc0005/go-nagios/README.md +++ b/vendor/github.com/atc0005/go-nagios/README.md @@ -155,14 +155,13 @@ using either this library or the original project. - Nagios - - - + - - - - - - - - - - - + - [max plugin output length](https://github.com/NagiosEnterprises/nagioscore/blob/a30a89e0a493da49416e32ed770e294b1fe800f5/include/nagios.h#L274-L280) + - [character restrictions applicable to LongServiceOutput macro](https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/configmain.html#illegal_macro_output_chars) - Icinga - - diff --git a/vendor/github.com/atc0005/go-nagios/nagios.go b/vendor/github.com/atc0005/go-nagios/nagios.go index dce167ce..cf56e17d 100644 --- a/vendor/github.com/atc0005/go-nagios/nagios.go +++ b/vendor/github.com/atc0005/go-nagios/nagios.go @@ -315,7 +315,7 @@ func (p *Plugin) ReturnCheckResults() { // If set, call user-provided branding function before emitting // performance data and exiting application. if p.BrandingCallback != nil { - fmt.Fprintf(&output, "%s%s%s", CheckOutputEOL, p.BrandingCallback(), CheckOutputEOL) + _, _ = fmt.Fprintf(&output, "%s%s%s", CheckOutputEOL, p.BrandingCallback(), CheckOutputEOL) } p.handlePerformanceData(&output) @@ -330,7 +330,7 @@ func (p *Plugin) ReturnCheckResults() { // TODO: Perhaps just don't emit anything at all? switch { case p.shouldSkipOSExit: - fmt.Fprintln(os.Stderr, "Skipping os.Exit call as requested.") + _, _ = fmt.Fprintln(os.Stderr, "Skipping os.Exit call as requested.") default: os.Exit(p.ExitStatusCode) } @@ -427,7 +427,20 @@ func (p Plugin) emitOutput(pluginOutput string) { p.outputSink = os.Stdout } - fmt.Fprint(p.outputSink, pluginOutput) + // Attempt to write to output sink. If this fails, send error to + // os.Stderr. If that fails (however unlikely), we have bigger problems + // and should abort. + _, sinkWriteErr := fmt.Fprint(p.outputSink, pluginOutput) + if sinkWriteErr != nil { + _, stdErrWriteErr := fmt.Fprintf( + os.Stderr, + "Failed to write output to given output sink: %s", + sinkWriteErr.Error(), + ) + if stdErrWriteErr != nil { + panic("Failed to initial output sink failure error message to stderr") + } + } } // tryAddDefaultTimeMetric inserts a default `time` performance data metric diff --git a/vendor/github.com/atc0005/go-nagios/perfdata.go b/vendor/github.com/atc0005/go-nagios/perfdata.go index 2e6a8513..26301235 100644 --- a/vendor/github.com/atc0005/go-nagios/perfdata.go +++ b/vendor/github.com/atc0005/go-nagios/perfdata.go @@ -322,22 +322,22 @@ func parsePerfData(perfdataString string) (PerformanceData, error) { rawWarn, rawCrit, rawMin, rawMax := extractRawWarnCritMinMaxRawFieldVals(perfdataFields) - warn, err := parsePerfDataWarnField(rawWarn) + warnVal, err := parsePerfDataWarnField(rawWarn) if err != nil { return PerformanceData{}, fmt.Errorf("failed to parse warn field: %w", err) } - crit, err := parsePerfDataCritField(rawCrit) + critVal, err := parsePerfDataCritField(rawCrit) if err != nil { return PerformanceData{}, fmt.Errorf("failed to parse crit field: %w", err) } - min, err := parsePerfDataMinField(rawMin) + minVal, err := parsePerfDataMinField(rawMin) if err != nil { return PerformanceData{}, fmt.Errorf("failed to parse min field: %w", err) } - max, err := parsePerfDataMaxField(rawMax) + maxVal, err := parsePerfDataMaxField(rawMax) if err != nil { return PerformanceData{}, fmt.Errorf("failed to parse max field: %w", err) } @@ -346,10 +346,10 @@ func parsePerfData(perfdataString string) (PerformanceData, error) { Label: label, Value: value, UnitOfMeasurement: uom, - Warn: warn, - Crit: crit, - Min: min, - Max: max, + Warn: warnVal, + Crit: critVal, + Min: minVal, + Max: maxVal, } return perfdata, nil @@ -494,27 +494,27 @@ func extractValueAndUoM(input string) (string, string, error) { // fields) into Warn, Crit, Min and Max values. If values are not present for // those fields an empty string is returned in its place. func extractRawWarnCritMinMaxRawFieldVals(perfdataFields []string) (string, string, string, string) { - var warn string + var warnVal string if len(perfdataFields) >= 2 { - warn = perfdataFields[1] + warnVal = perfdataFields[1] } - var crit string + var critVal string if len(perfdataFields) >= 3 { - crit = perfdataFields[2] + critVal = perfdataFields[2] } - var min string + var minVal string if len(perfdataFields) >= 4 { - min = perfdataFields[3] + minVal = perfdataFields[3] } - var max string + var maxVal string if len(perfdataFields) >= 5 { - max = perfdataFields[4] + maxVal = perfdataFields[4] } - return warn, crit, min, max + return warnVal, critVal, minVal, maxVal } // parsePerfDataWarnField evaluates the given input string as a Performance diff --git a/vendor/github.com/atc0005/go-nagios/sections.go b/vendor/github.com/atc0005/go-nagios/sections.go index f8b023f2..e394e036 100644 --- a/vendor/github.com/atc0005/go-nagios/sections.go +++ b/vendor/github.com/atc0005/go-nagios/sections.go @@ -33,7 +33,7 @@ func (p Plugin) handleServiceOutputSection(w io.Writer) { // formatting changes to this content, simply emit it as-is. This helps // avoid potential issues with literal characters being interpreted as // formatting verbs. - fmt.Fprint(w, p.ServiceOutput) + _, _ = fmt.Fprint(w, p.ServiceOutput) } // handleErrorsSection is a wrapper around the logic used to handle/process @@ -44,7 +44,7 @@ func (p Plugin) handleErrorsSection(w io.Writer) { // hide the section ... if !p.isErrorsHidden() { - fmt.Fprintf(w, + _, _ = fmt.Fprintf(w, "%s%s**%s**%s%s", CheckOutputEOL, CheckOutputEOL, @@ -54,13 +54,13 @@ func (p Plugin) handleErrorsSection(w io.Writer) { ) if p.LastError != nil { - fmt.Fprintf(w, "* %v%s", p.LastError, CheckOutputEOL) + _, _ = fmt.Fprintf(w, "* %v%s", p.LastError, CheckOutputEOL) } // Process any non-nil errors in the collection. for _, err := range p.Errors { if err != nil { - fmt.Fprintf(w, "* %v%s", err, CheckOutputEOL) + _, _ = fmt.Fprintf(w, "* %v%s", err, CheckOutputEOL) } } @@ -80,7 +80,7 @@ func (p Plugin) handleThresholdsSection(w io.Writer) { // not opted to hide the section ... if !p.isThresholdsSectionHidden() { - fmt.Fprintf(w, + _, _ = fmt.Fprintf(w, "%s**%s**%s%s", CheckOutputEOL, p.getThresholdsLabelText(), @@ -89,7 +89,7 @@ func (p Plugin) handleThresholdsSection(w io.Writer) { ) if p.CriticalThreshold != "" { - fmt.Fprintf(w, + _, _ = fmt.Fprintf(w, "* %s: %v%s", StateCRITICALLabel, p.CriticalThreshold, @@ -98,7 +98,7 @@ func (p Plugin) handleThresholdsSection(w io.Writer) { } if p.WarningThreshold != "" { - fmt.Fprintf(w, + _, _ = fmt.Fprintf(w, "* %s: %v%s", StateWARNINGLabel, p.WarningThreshold, @@ -129,21 +129,21 @@ func (p Plugin) handleLongServiceOutput(w io.Writer) { // ServiceOutput content. switch { case !p.isThresholdsSectionHidden() || !p.isErrorsHidden(): - fmt.Fprintf(w, + _, _ = fmt.Fprintf(w, "%s**%s**%s", CheckOutputEOL, p.getDetailedInfoLabelText(), CheckOutputEOL, ) default: - fmt.Fprint(w, CheckOutputEOL) + _, _ = fmt.Fprint(w, CheckOutputEOL) } // Note: fmt.Println() (and fmt.Fprintln()) has the same issue as `\n`: // Nagios seems to interpret them literally instead of emitting an actual // newline. We work around that by using fmt.Fprintf() for output that is // intended for display within the Nagios web UI. - fmt.Fprintf(w, + _, _ = fmt.Fprintf(w, "%s%v%s", CheckOutputEOL, p.LongServiceOutput, @@ -174,18 +174,18 @@ func (p *Plugin) handlePerformanceData(w io.Writer) { // metrics are provided as a single line, leading with a pipe // character, a space and one or more metrics each separated from // another by a single space. - fmt.Fprint(w, " |") + _, _ = fmt.Fprint(w, " |") // Sort performance data values prior to emitting them so that the // output is consistent across plugin execution. perfData := p.getSortedPerfData() for _, pd := range perfData { - fmt.Fprint(w, pd.String()) + _, _ = fmt.Fprint(w, pd.String()) } // Add final trailing newline to satisfy Nagios plugin output format. - fmt.Fprint(w, CheckOutputEOL) + _, _ = fmt.Fprint(w, CheckOutputEOL) } diff --git a/vendor/modules.txt b/vendor/modules.txt index f79241a4..afce8602 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/atc0005/go-nagios v0.16.1 +# github.com/atc0005/go-nagios v0.16.2 ## explicit; go 1.19 github.com/atc0005/go-nagios # github.com/emersion/go-imap v1.2.1