I bit confuse to filter values with some conditional returns, I have this response, that I parsed from grafana request. How can I bring out only if values > 25?
Not sure what you are asking, but map[…] is just a debugging representation. It is not “returned”, neither do you need to return values “without it”.
I have figured out using append, but it only append 1 by 1 values:
filtered = make(map[string]float64)
var out []string
for key, value := range response {
if value > 55 {
filtered[key] = value
// fmt.Println(key, value)
out = append(out, key)
fmt.Println(out)
}
}
}
Thanks for your reply @clbanning, my purpose is sending filtered values using SMTP Gmail. I got some errors like this while calling send func() inside message []byte :
message := []byte("Subject:" + subject + "\n\n" +
"CPU with the condition over than 80%: " +
fmt.Sprintf(`{"items":"%v"}`, checklink))
My error:
checkURLS(links) used as value
too many arguments to return
have (string)
want ()