Your value
is already a pointer to a struct. Try printing out s.Kind()
in your code.
There's no reason to take the address osof value
, then call Elem()
on that reflect.Value
, which dereferences the pointer you just created.
s := reflect.ValueOf(value).Elem()
metric := s.FieldByName(subvalMetric).Interface()
fmt.Println(metric)