Skip to content

Commit

Permalink
Merge pull request #1152 from atc0005/fix-errcheck-linting-errors-sta…
Browse files Browse the repository at this point in the history
…ble-branch

Fix errcheck linting errors
  • Loading branch information
atc0005 authored Jun 1, 2024
2 parents 0d3b0ef + 2927927 commit 69e5248
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 206 deletions.
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ var Usage = func() {
// `--help` flag and have it display within the Admin web UI.
flag.CommandLine.SetOutput(os.Stdout)

fmt.Fprintln(flag.CommandLine.Output(), "\n"+Version()+"\n")
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
_, _ = fmt.Fprintln(flag.CommandLine.Output(), "\n"+Version()+"\n")
_, _ = fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
flag.PrintDefaults()
}

Expand Down
4 changes: 2 additions & 2 deletions internal/config/dsperf.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (mvdsperf *MultiValueDSPerfPercentileSetFlag) String() string {
var output strings.Builder

for _, p := range percentiles {
fmt.Fprintf(&output,
_, _ = fmt.Fprintf(&output,
"{Percentile: %v, ThresholdVals: %+v}, ",
p,
(*mvdsperf)[p],
Expand Down Expand Up @@ -203,7 +203,7 @@ func (mvdsperf MultiValueDSPerfPercentileSetFlag) thresholdValues(state string)
// )
}

fmt.Fprintf(&output,
_, _ = fmt.Fprintf(&output,
"{ Percentile: %v, ReadLatency: %+v, WriteLatency: %v, VMLatency: %v }, ",
p,
readLatency,
Expand Down
62 changes: 31 additions & 31 deletions internal/vsphere/alarms.go
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ func AlarmsReport(

var report strings.Builder

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"Non-excluded Triggered Alarms detected:%s%s",
nagios.CheckOutputEOL,
Expand All @@ -1761,7 +1761,7 @@ func AlarmsReport(

switch {
case numTriggeredAlarmsToReport == 0:
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* None%s%s",
nagios.CheckOutputEOL,
Expand All @@ -1773,7 +1773,7 @@ func AlarmsReport(
// only look at non-excluded alarms
if !triggeredAlarms[i].Exclude {
alarmCtr++
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* (%.2d) %s (type %s): %s%s",
alarmCtr,
Expand All @@ -1785,11 +1785,11 @@ func AlarmsReport(
}
}

fmt.Fprintf(&report, "%s", nagios.CheckOutputEOL)
_, _ = fmt.Fprintf(&report, "%s", nagios.CheckOutputEOL)

}

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"Excluded Triggered Alarms (as requested):%s%s",
nagios.CheckOutputEOL,
Expand All @@ -1798,7 +1798,7 @@ func AlarmsReport(

switch {
case triggeredAlarms.NumExcluded() == 0:
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* None%s%s",
nagios.CheckOutputEOL,
Expand All @@ -1810,7 +1810,7 @@ func AlarmsReport(
// only look at excluded alarms
if triggeredAlarms[i].Exclude {
alarmCtr++
fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* (%.2d) %s (type: %q, alarm name: %q, exclude reason: %q)%s",
alarmCtr,
Expand All @@ -1824,37 +1824,37 @@ func AlarmsReport(
}
}

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%s---%s%s",
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"%s**NOTE: Explicit exclusions have precedence over inclusions**%s%s",
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* vSphere environment: %s%s",
c.URL().String(),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Plugin User Agent: %s%s",
c.Client.UserAgent,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Triggered Alarms (evaluated: %d, ignored: %d, total: %d)%s",
numTriggeredAlarmsToReport,
Expand All @@ -1863,146 +1863,146 @@ func AlarmsReport(
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Acknowledged Triggered Alarms evaluated: %t%s",
triggeredAlarmFilters.EvaluateAcknowledgedAlarms,
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Triggered Alarms to explicitly include%s",
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** entity types (%d): [%v]%s",
len(triggeredAlarmFilters.IncludedAlarmEntityTypes),
strings.Join(triggeredAlarmFilters.IncludedAlarmEntityTypes, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** entity names (%d): [%v]%s",
len(triggeredAlarmFilters.IncludedAlarmEntityNames),
strings.Join(triggeredAlarmFilters.IncludedAlarmEntityNames, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** entity resource pools (%d): [%v]%s",
len(triggeredAlarmFilters.IncludedAlarmEntityResourcePools),
strings.Join(triggeredAlarmFilters.IncludedAlarmEntityResourcePools, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** names (%d): [%v]%s",
len(triggeredAlarmFilters.IncludedAlarmNames),
strings.Join(triggeredAlarmFilters.IncludedAlarmNames, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** descriptions (%d): [%v]%s",
len(triggeredAlarmFilters.IncludedAlarmDescriptions),
strings.Join(triggeredAlarmFilters.IncludedAlarmDescriptions, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** statuses (%d): [%v]%s",
len(triggeredAlarmFilters.IncludedAlarmStatuses),
strings.Join(triggeredAlarmFilters.IncludedAlarmStatuses, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Triggered Alarms to explicitly exclude%s",
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** entity types (%d): [%v]%s",
len(triggeredAlarmFilters.ExcludedAlarmEntityTypes),
strings.Join(triggeredAlarmFilters.ExcludedAlarmEntityTypes, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** entity names (%d): [%v]%s",
len(triggeredAlarmFilters.ExcludedAlarmEntityNames),
strings.Join(triggeredAlarmFilters.ExcludedAlarmEntityNames, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** entity resource pools (%d): [%v]%s",
len(triggeredAlarmFilters.ExcludedAlarmEntityResourcePools),
strings.Join(triggeredAlarmFilters.ExcludedAlarmEntityResourcePools, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** names (%d): [%v]%s",
len(triggeredAlarmFilters.ExcludedAlarmNames),
strings.Join(triggeredAlarmFilters.ExcludedAlarmNames, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** descriptions (%d): [%v]%s",
len(triggeredAlarmFilters.ExcludedAlarmDescriptions),
strings.Join(triggeredAlarmFilters.ExcludedAlarmDescriptions, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"** statuses (%d): [%v]%s",
len(triggeredAlarmFilters.ExcludedAlarmStatuses),
strings.Join(triggeredAlarmFilters.ExcludedAlarmStatuses, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Datacenters specified (%d): [%v]%s",
len(specifiedDatacenters),
strings.Join(specifiedDatacenters, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Datacenters evaluated (%d): [%v]%s",
len(datacentersEvaluated),
strings.Join(datacentersEvaluated, ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Datacenters with Triggered Alarms (%d): [%v]%s",
len(triggeredAlarms.Datacenters()),
strings.Join(triggeredAlarms.Datacenters(), ", "),
nagios.CheckOutputEOL,
)

fmt.Fprintf(
_, _ = fmt.Fprintf(
&report,
"* Resource Pools with Triggered Alarms (%d): [%v]%s",
len(triggeredAlarms.ResourcePools()),
Expand Down
Loading

0 comments on commit 69e5248

Please sign in to comment.