Skip to content

Commit c9aa64b

Browse files
RincewindsHatLorenz Kästle
and
Lorenz Kästle
authored
Remove Strings as perfdata values (#117)
* Remove Strings as perfdata values --------- Co-authored-by: Lorenz Kästle <[email protected]>
1 parent 3ece825 commit c9aa64b

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

perfdata/type.go

-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ func formatNumeric(value interface{}) (string, error) {
4343
return check.FormatFloat(float64(v)), nil
4444
case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64:
4545
return fmt.Sprintf("%d", v), nil
46-
case fmt.Stringer, string:
47-
return fmt.Sprint(v), nil
4846
default:
4947
panic(fmt.Sprintf("unsupported type for perfdata: %T", value))
5048
}

perfdata/type_test.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,11 @@ func TestFormatNumeric(t *testing.T) {
123123
},
124124
{
125125
Result: "1234.567",
126-
InputValue: 1234.567,
126+
InputValue: float64(1234.567),
127127
},
128128
{
129-
Result: "1234.567",
130-
InputValue: float32(1234.567),
131-
},
132-
{Result: "1234.567",
133-
InputValue: "1234.567",
129+
Result: "3456.789",
130+
InputValue: float32(3456.789),
134131
},
135132
{
136133
Result: "1234567890.988",

0 commit comments

Comments
 (0)