Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errcheck linting errors #350

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ func (c *Config) handleFlagsConfig(appType AppType) {
// with the `--help` flag and have it display within the Admin web UI.
flag.CommandLine.SetOutput(os.Stdout)

fmt.Fprintln(flag.CommandLine.Output(), headerText)
_, _ = fmt.Fprintln(flag.CommandLine.Output(), headerText)
flag.PrintDefaults()
fmt.Fprintln(flag.CommandLine.Output(), positionalArgRequirements)
fmt.Fprintln(flag.CommandLine.Output(), footerText)
_, _ = fmt.Fprintln(flag.CommandLine.Output(), positionalArgRequirements)
_, _ = fmt.Fprintln(flag.CommandLine.Output(), footerText)
}

// parse flag definitions from the argument list
Expand Down
24 changes: 12 additions & 12 deletions internal/restart/reports/reports.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,34 @@ func CheckRebootOneLineSummary(assertions restart.RebootRequiredAsserters, evalI
//nolint:all
//lint:ignore U1000 disabling use per GH-119, but may re-enable later via flag
func writeReportHeader(w io.Writer, assertions restart.RebootRequiredAsserters, verbose bool) {
fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
"%[1]sSummary:%[1]s%[1]s",
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
" - %d total reboot assertions applied%s",
assertions.NumApplied(),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
" - %d total reboot assertions matched%s",
assertions.NumMatched(),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
" - %d total reboot assertions ignored%s",
assertions.NumIgnored(),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
"%[1]s%[2]s%[1]s%[1]s",
nagios.CheckOutputEOL,
Expand All @@ -125,7 +125,7 @@ func writeAssertions(w io.Writer, assertions restart.RebootRequiredAsserters, ve
// While there is *usually* one reason for a reboot, the current
// design allows for multiple reasons.
for _, reason := range assertion.RebootReasons() {
fmt.Fprintf(w, topDetailTemplateStr, reason, nagios.CheckOutputEOL)
_, _ = fmt.Fprintf(w, topDetailTemplateStr, reason, nagios.CheckOutputEOL)

// We are processing types beneath RebootReasons so that we can
// emit more detailed information following a "standard" reboot
Expand All @@ -137,7 +137,7 @@ func writeAssertions(w io.Writer, assertions restart.RebootRequiredAsserters, ve
}
}

fmt.Fprint(w, nagios.CheckOutputEOL)
_, _ = fmt.Fprint(w, nagios.CheckOutputEOL)
}

// CheckRebootReport returns a formatted report of the evaluation results
Expand All @@ -156,7 +156,7 @@ func CheckRebootReport(assertions restart.RebootRequiredAsserters, showIgnored b

// writeMatchedPaths(&report, assertions, verbose)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"Reboot required because:%[1]s",
nagios.CheckOutputEOL,
Expand All @@ -169,12 +169,12 @@ func CheckRebootReport(assertions restart.RebootRequiredAsserters, showIgnored b
writeAssertions(&report, notIgnoredAssertions, verbose)

case assertions.IsOKState():
fmt.Fprintf(&report, "Reboot not required%s", nagios.CheckOutputEOL)
_, _ = fmt.Fprintf(&report, "Reboot not required%s", nagios.CheckOutputEOL)

}

if assertions.HasIgnored() && showIgnored {
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%[1]sAssertions ignored:%[1]s",
nagios.CheckOutputEOL,
Expand Down Expand Up @@ -206,7 +206,7 @@ func appendAdditionalContext(
logger.Printf("%q has subpath evidence", assertion.String())

for _, path := range v.MatchedPaths() {
fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
subDetailTemplateStr,
"subpath: "+path.Base(),
Expand All @@ -225,7 +225,7 @@ func appendAdditionalContext(
case restart.RebootRequiredAsserterWithDataDisplay:
logger.Printf("Type assertion worked, value available for check result")

fmt.Fprintf(
_, _ = fmt.Fprintf(
w,
subDetailTemplateStr,
v.DataDisplay(),
Expand Down