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 (
"encoding/json"
"fmt"
lp "github.com/influxdata/line-protocol"
"io/ioutil"
"strconv"
"strings"
"time"
lp "github.com/influxdata/line-protocol"
)
const CPUSTATFILE = `/proc/stat`
@ -88,5 +89,4 @@ func (m *CpustatCollector) Read(interval time.Duration, out *[]lp.MutableMetric)
func (m *CpustatCollector) Close() {
m.init = false
return
}

View File

@ -3,12 +3,13 @@ package collectors
import (
"encoding/json"
"errors"
lp "github.com/influxdata/line-protocol"
"io/ioutil"
"log"
"os/exec"
"strings"
"time"
lp "github.com/influxdata/line-protocol"
)
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() {
m.init = false
return
}

View File

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

View File

@ -17,13 +17,11 @@ import (
lp "github.com/influxdata/line-protocol"
)
type GpfsCollectorConfig struct {
Mmpmon string `json:"mmpmon"`
}
type GpfsCollector struct {
MetricCollector
config GpfsCollectorConfig
config struct {
Mmpmon string `json:"mmpmon"`
}
}
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() {
m.init = false
return
}

View File

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

View File

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

View File

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

View File

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

View File

@ -3,12 +3,13 @@ package collectors
import (
"encoding/json"
"errors"
lp "github.com/influxdata/line-protocol"
"io/ioutil"
"log"
"strconv"
"strings"
"time"
lp "github.com/influxdata/line-protocol"
)
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() {
m.init = false
return
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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