Fix QF1011: could omit type ... from declaration; it will be inferred from the right-hand side (staticcheck)

This commit is contained in:
Holger Obermaier
2026-02-04 10:23:23 +01:00
parent 86710d9b4b
commit 159bee1e9f
4 changed files with 7 additions and 7 deletions

View File

@@ -174,7 +174,7 @@ func (m *MemstatCollector) Read(interval time.Duration, output chan lp.CCMessage
sendStats := func(stats map[string]MemstatStats, tags map[string]string) { sendStats := func(stats map[string]MemstatStats, tags map[string]string) {
for match, name := range m.matches { for match, name := range m.matches {
var value float64 = 0 var value float64 = 0
var unit string = "" unit := ""
if v, ok := stats[match]; ok { if v, ok := stats[match]; ok {
value = v.value value = v.value
if len(v.unit) > 0 { if len(v.unit) > 0 {

View File

@@ -222,7 +222,7 @@ func readMemoryInfo(device *NvidiaCollectorDevice, output chan lp.CCMessage) err
var total uint64 var total uint64
var used uint64 var used uint64
var reserved uint64 = 0 var reserved uint64 = 0
var v2 bool = false v2 := false
meminfo, ret := nvml.DeviceGetMemoryInfo(device.device) meminfo, ret := nvml.DeviceGetMemoryInfo(device.device)
if ret != nvml.SUCCESS { if ret != nvml.SUCCESS {
err := errors.New(nvml.ErrorString(ret)) err := errors.New(nvml.ErrorString(ret))
@@ -768,7 +768,7 @@ func readRemappedRows(device *NvidiaCollectorDevice, output chan lp.CCMessage) e
} }
} }
if !device.excludeMetrics["nv_remapped_rows_pending"] { if !device.excludeMetrics["nv_remapped_rows_pending"] {
var p int = 0 p := 0
if pending { if pending {
p = 1 p = 1
} }
@@ -778,7 +778,7 @@ func readRemappedRows(device *NvidiaCollectorDevice, output chan lp.CCMessage) e
} }
} }
if !device.excludeMetrics["nv_remapped_rows_failure"] { if !device.excludeMetrics["nv_remapped_rows_failure"] {
var f int = 0 f := 0
if failure { if failure {
f = 1 f = 1
} }

View File

@@ -169,7 +169,7 @@ func medianfunc(args interface{}) (interface{}, error) {
func lenfunc(args interface{}) (interface{}, error) { func lenfunc(args interface{}) (interface{}, error) {
var err error = nil var err error = nil
var length int = 0 length := 0
switch values := args.(type) { switch values := args.(type) {
case []float64: case []float64:
length = len(values) length = len(values)

View File

@@ -161,8 +161,8 @@ func (c *metricCache) DeleteAggregation(name string) error {
// is the current one, index=1 the last interval and so on. Returns and empty array if a wrong index // is the current one, index=1 the last interval and so on. Returns and empty array if a wrong index
// is given (negative index, index larger than configured number of total intervals, ...) // is given (negative index, index larger than configured number of total intervals, ...)
func (c *metricCache) GetPeriod(index int) (time.Time, time.Time, []lp.CCMessage) { func (c *metricCache) GetPeriod(index int) (time.Time, time.Time, []lp.CCMessage) {
var start time.Time = time.Now() start := time.Now()
var stop time.Time = time.Now() stop := time.Now()
var metrics []lp.CCMessage var metrics []lp.CCMessage
if index >= 0 && index < c.numPeriods { if index >= 0 && index < c.numPeriods {
pindex := c.curPeriod - index pindex := c.curPeriod - index