mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 04:06:24 +00:00
enabled a few more linter rules
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetOSVersionLinux(t *testing.T) {
|
||||
t.Parallel()
|
||||
testCases := []struct {
|
||||
name string
|
||||
fakeOSReleasePath string
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestPrometheusMetricsParsingAndMatching(t *testing.T) {
|
||||
// Metric with non-existent label.
|
||||
{
|
||||
Name: "host_uptime",
|
||||
Labels: map[string]string{"non-existant-version": "0.0.1"},
|
||||
Labels: map[string]string{"non-existent-version": "0.0.1"},
|
||||
},
|
||||
// Metric with incorrect label.
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
type CmdlineArg struct {
|
||||
@@ -25,7 +27,11 @@ type CmdlineArg struct {
|
||||
}
|
||||
|
||||
func (d CmdlineArg) String() string {
|
||||
s, _ := json.Marshal(d)
|
||||
s, err := json.Marshal(d)
|
||||
if err != nil {
|
||||
klog.Errorf("failed to marshal cmdline arg: %v", err)
|
||||
return ""
|
||||
}
|
||||
return string(s)
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
type Module struct {
|
||||
@@ -29,7 +31,11 @@ type Module struct {
|
||||
}
|
||||
|
||||
func (d Module) String() string {
|
||||
s, _ := json.Marshal(d)
|
||||
s, err := json.Marshal(d)
|
||||
if err != nil {
|
||||
klog.Errorf("failed to marshal module stat: %v", err)
|
||||
return ""
|
||||
}
|
||||
return string(s)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user