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" {
switch value := v.(type) {
case float64:
argstr = append(argstr, fmt.Sprintf("--value=%v", value))
argstr = append(argstr, "--type=double")
argstr = append(argstr,
fmt.Sprintf("--value=%v", value), "--type=double")
case float32:
argstr = append(argstr, fmt.Sprintf("--value=%v", value))
argstr = append(argstr, "--type=float")
argstr = append(argstr,
fmt.Sprintf("--value=%v", value), "--type=float")
case int:
argstr = append(argstr, fmt.Sprintf("--value=%d", value))
argstr = append(argstr, "--type=int32")
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=int32")
case int64:
argstr = append(argstr, fmt.Sprintf("--value=%d", value))
argstr = append(argstr, "--type=int32")
argstr = append(argstr,
fmt.Sprintf("--value=%d", value), "--type=int32")
case string:
argstr = append(argstr, fmt.Sprintf("--value=%q", value))
argstr = append(argstr, "--type=string")
argstr = append(argstr,
fmt.Sprintf("--value=%q", value), "--type=string")
}
}
}