@@ -15,7 +15,7 @@ import (
1515)
1616
1717// DeserializeProtoValuesFromGroup deserializes the value for all values in a config group
18- func DeserializeProtoValuesFromGroup (group * cb.ConfigGroup , protosStructs ... interface {} ) error {
18+ func DeserializeProtoValuesFromGroup (group * cb.ConfigGroup , protosStructs ... any ) error {
1919 sv , err := NewStandardValues (protosStructs ... )
2020 if err != nil {
2121 logger .Panicf ("This is a compile time bug only, the proto structures are somehow invalid: %s" , err )
@@ -38,7 +38,7 @@ type StandardValues struct {
3838// the same condition. NewStandard values will instantiate memory for all the proto
3939// messages and build a lookup map from structure field name to proto message instance
4040// This is a useful way to easily implement the Values interface
41- func NewStandardValues (protosStructs ... interface {} ) (* StandardValues , error ) {
41+ func NewStandardValues (protosStructs ... any ) (* StandardValues , error ) {
4242 sv := & StandardValues {
4343 lookup : make (map [string ]proto.Message ),
4444 }
@@ -72,19 +72,19 @@ func (sv *StandardValues) Deserialize(key string, value []byte) (proto.Message,
7272
7373func (sv * StandardValues ) initializeProtosStruct (objValue reflect.Value ) error {
7474 objType := objValue .Type ()
75- if objType .Kind () != reflect .Ptr {
75+ if objType .Kind () != reflect .Pointer {
7676 return fmt .Errorf ("Non pointer type" )
7777 }
7878 if objType .Elem ().Kind () != reflect .Struct {
7979 return fmt .Errorf ("Non struct type" )
8080 }
8181
8282 numFields := objValue .Elem ().NumField ()
83- for i := 0 ; i < numFields ; i ++ {
83+ for i := range numFields {
8484 structField := objType .Elem ().Field (i )
8585 logger .Debugf ("Processing field: %s\n " , structField .Name )
8686 switch structField .Type .Kind () {
87- case reflect .Ptr :
87+ case reflect .Pointer :
8888 fieldPtr := objValue .Elem ().Field (i )
8989 if ! fieldPtr .CanSet () {
9090 return fmt .Errorf ("Cannot set structure field %s (unexported?)" , structField .Name )
0 commit comments