Avoid staticcheck warning: redundant return statement

This commit is contained in:
Holger Obermaier 2022-01-21 14:35:52 +01:00
parent 83b784e6f0
commit 5dd2af4e8f
15 changed files with 34 additions and 38 deletions

View File

@ -3,11 +3,12 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const CPUSTATFILE = `/proc/stat` const CPUSTATFILE = `/proc/stat`
@ -88,5 +89,4 @@ func (m *CpustatCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
func (m *CpustatCollector) Close() { func (m *CpustatCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -3,12 +3,13 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"log" "log"
"os/exec" "os/exec"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom` const CUSTOMCMDPATH = `/home/unrz139/Work/cc-metric-collector/collectors/custom`
@ -126,5 +127,4 @@ func (m *CustomCmdCollector) Read(interval time.Duration, out *[]lp.MutableMetri
func (m *CustomCmdCollector) Close() { func (m *CustomCmdCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -1,8 +1,10 @@
package collectors package collectors
import ( import (
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
lp "github.com/influxdata/line-protocol"
// "log" // "log"
"encoding/json" "encoding/json"
"errors" "errors"
@ -107,10 +109,8 @@ func (m *DiskstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric
} }
} }
} }
return
} }
func (m *DiskstatCollector) Close() { func (m *DiskstatCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -17,13 +17,11 @@ import (
lp "github.com/influxdata/line-protocol" lp "github.com/influxdata/line-protocol"
) )
type GpfsCollectorConfig struct {
Mmpmon string `json:"mmpmon"`
}
type GpfsCollector struct { type GpfsCollector struct {
MetricCollector MetricCollector
config GpfsCollectorConfig config struct {
Mmpmon string `json:"mmpmon"`
}
} }
func (m *GpfsCollector) Init(config []byte) error { func (m *GpfsCollector) Init(config []byte) error {
@ -297,5 +295,4 @@ func (m *GpfsCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
func (m *GpfsCollector) Close() { func (m *GpfsCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -2,10 +2,12 @@ package collectors
import ( import (
"fmt" "fmt"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"log" "log"
"os/exec" "os/exec"
lp "github.com/influxdata/line-protocol"
// "os" // "os"
"encoding/json" "encoding/json"
"errors" "errors"
@ -278,5 +280,4 @@ func (m *InfinibandCollector) Read(interval time.Duration, out *[]lp.MutableMetr
func (m *InfinibandCollector) Close() { func (m *InfinibandCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -3,13 +3,14 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
lp "github.com/influxdata/line-protocol"
"log" "log"
"os" "os"
"os/exec" "os/exec"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const IPMITOOL_PATH = `/usr/bin/ipmitool` const IPMITOOL_PATH = `/usr/bin/ipmitool`
@ -133,5 +134,4 @@ func (m *IpmiCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
func (m *IpmiCollector) Close() { func (m *IpmiCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -12,8 +12,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
lp "github.com/influxdata/line-protocol"
"gopkg.in/Knetic/govaluate.v2"
"io/ioutil" "io/ioutil"
"log" "log"
"math" "math"
@ -22,6 +20,9 @@ import (
"strings" "strings"
"time" "time"
"unsafe" "unsafe"
lp "github.com/influxdata/line-protocol"
"gopkg.in/Knetic/govaluate.v2"
) )
type LikwidCollectorMetricConfig struct { type LikwidCollectorMetricConfig struct {
@ -303,5 +304,4 @@ func (m *LikwidCollector) Close() {
C.perfmon_finalize() C.perfmon_finalize()
C.topology_finalize() C.topology_finalize()
} }
return
} }

View File

@ -2,11 +2,12 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const LOADAVGFILE = `/proc/loadavg` const LOADAVGFILE = `/proc/loadavg`
@ -76,5 +77,4 @@ func (m *LoadavgCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
func (m *LoadavgCollector) Close() { func (m *LoadavgCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -3,12 +3,13 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"log" "log"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats` const LUSTREFILE = `/proc/fs/lustre/llite/lnec-XXXXXX/stats`
@ -102,5 +103,4 @@ func (m *LustreCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
func (m *LustreCollector) Close() { func (m *LustreCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -4,12 +4,13 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"log" "log"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const MEMSTATFILE = `/proc/meminfo` const MEMSTATFILE = `/proc/meminfo`
@ -125,5 +126,4 @@ func (m *MemstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
func (m *MemstatCollector) Close() { func (m *MemstatCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -2,12 +2,13 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"log" "log"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const NETSTATFILE = `/proc/net/dev` const NETSTATFILE = `/proc/net/dev`
@ -84,5 +85,4 @@ func (m *NetstatCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
func (m *NetstatCollector) Close() { func (m *NetstatCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -4,10 +4,11 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/NVIDIA/go-nvml/pkg/nvml"
lp "github.com/influxdata/line-protocol"
"log" "log"
"time" "time"
"github.com/NVIDIA/go-nvml/pkg/nvml"
lp "github.com/influxdata/line-protocol"
) )
type NvidiaCollectorConfig struct { type NvidiaCollectorConfig struct {
@ -267,5 +268,4 @@ func (m *NvidiaCollector) Close() {
nvml.Shutdown() nvml.Shutdown()
m.init = false m.init = false
} }
return
} }

View File

@ -3,13 +3,14 @@ package collectors
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
lp "github.com/influxdata/line-protocol"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const HWMON_PATH = `/sys/class/hwmon` const HWMON_PATH = `/sys/class/hwmon`
@ -105,5 +106,4 @@ func (m *TempCollector) Read(interval time.Duration, out *[]lp.MutableMetric) {
func (m *TempCollector) Close() { func (m *TempCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -4,11 +4,12 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
lp "github.com/influxdata/line-protocol"
"log" "log"
"os/exec" "os/exec"
"strings" "strings"
"time" "time"
lp "github.com/influxdata/line-protocol"
) )
const MAX_NUM_PROCS = 10 const MAX_NUM_PROCS = 10
@ -74,5 +75,4 @@ func (m *TopProcsCollector) Read(interval time.Duration, out *[]lp.MutableMetric
func (m *TopProcsCollector) Close() { func (m *TopProcsCollector) Close() {
m.init = false m.init = false
return
} }

View File

@ -59,6 +59,4 @@ func (s *StdoutSink) Flush() error {
return nil return nil
} }
func (s *StdoutSink) Close() { func (s *StdoutSink) Close() {}
return
}