expvarmon
expvarmon copied to clipboard
Breaks if the map key contains "\x" string
trafficstars
Hi,
Given the following snippet:
package main
import (
"expvar"
"net/http"
)
func main() {
m := expvar.NewMap("test")
m.Add("\x00", 1)
http.ListenAndServe(":1234", nil)
}
Expvarmon stops showing results all together. You can add a sleep time before the add and observe it only happens when the string is added.
This looks like a bug in expvar itself, as it doesn't use a JSON encoder but rather just spits out key-value strings with the %q format specifier... see https://github.com/golang/go/blob/master/src/expvar/expvar.go#L331