func respond(w http.ResponseWriter, r *http.Request, data []interface{}) error { publicData := make([]interface{}, len(data)) for i, d := range data { publicData[i] = meander.Public(d) } return json.NewEncoder(w).Encode(publicData) }
func TestPublic(t *testing.T) { is := is.New(t) o := &obj{ value1: "value1", value2: "value2", value3: "value3", } v, ok := meander.Public(o).(map[string]interface{}) is.Equal(true, ok) // "Result should be msi" is.Equal(v["one"], "value1") is.Nil(v["two"]) // value2 is.Equal(v["three"], "value3") }