Avoid one append

This commit is contained in:
Holger Obermaier 2022-02-11 15:34:12 +01:00
parent dc1e4f28a0
commit e4285f02c5

View File

@ -113,20 +113,20 @@ func (s *GangliaSink) Write(point lp.CCMetric) error {
if k == "value" { if k == "value" {
switch value := v.(type) { switch value := v.(type) {
case float64: case float64:
argstr = append(argstr, fmt.Sprintf("--value=%v", value)) argstr = append(argstr,
argstr = append(argstr, "--type=double") fmt.Sprintf("--value=%v", value), "--type=double")
case float32: case float32:
argstr = append(argstr, fmt.Sprintf("--value=%v", value)) argstr = append(argstr,
argstr = append(argstr, "--type=float") fmt.Sprintf("--value=%v", value), "--type=float")
case int: case int:
argstr = append(argstr, fmt.Sprintf("--value=%d", value)) argstr = append(argstr,
argstr = append(argstr, "--type=int32") fmt.Sprintf("--value=%d", value), "--type=int32")
case int64: case int64:
argstr = append(argstr, fmt.Sprintf("--value=%d", value)) argstr = append(argstr,
argstr = append(argstr, "--type=int32") fmt.Sprintf("--value=%d", value), "--type=int32")
case string: case string:
argstr = append(argstr, fmt.Sprintf("--value=%q", value)) argstr = append(argstr,
argstr = append(argstr, "--type=string") fmt.Sprintf("--value=%q", value), "--type=string")
} }
} }
} }