expvarmon icon indicating copy to clipboard operation
expvarmon copied to clipboard

Breaks if the map key contains "\x" string

Open arsham opened this issue 9 years ago • 1 comments
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.

arsham avatar Jul 10 '16 15:07 arsham

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

marklr avatar Jan 15 '17 11:01 marklr