conf icon indicating copy to clipboard operation
conf copied to clipboard

behavior with maps

Open kevinburkesegment opened this issue 3 years ago • 0 comments

I guess I expected based on the Map abstraction that you could deserialize config into either a map or a struct. One of the first tests I wrote did this:

       source := NewKubernetesConfigMapSource("./testdata/configmap")
       base := make(map[string]string)
       mp := makeNodeMap(reflect.ValueOf(base), reflect.TypeOf(base))
       if err := source.Load(mp); err != nil {
               t.Fatal(err)
       }

Which "worked" but produces a panic if you try Loader.Load.

We should maybe try to make more clear that you should only be passing structs, maybe by also panicking further down.

kevinburkesegment avatar Jul 25 '22 04:07 kevinburkesegment