@@ -36,10 +36,10 @@ const (
3636)
3737
3838var (
39- globalOptionTypeName = reflect .TypeOf ( GlobalOptions {} ).Name ()
40- monitorOptionTypeName = reflect .TypeOf ( MonitoredOptions {} ).Name ()
41- serverConfigsTypeName = reflect .TypeOf ( DMServerConfigs {} ).Name ()
42- componentSourcesTypeName = reflect .TypeOf ( ComponentSources {} ).Name ()
39+ globalOptionTypeName = reflect .TypeFor [ GlobalOptions ]( ).Name ()
40+ monitorOptionTypeName = reflect .TypeFor [ MonitoredOptions ]( ).Name ()
41+ serverConfigsTypeName = reflect .TypeFor [ DMServerConfigs ]( ).Name ()
42+ componentSourcesTypeName = reflect .TypeFor [ ComponentSources ]( ).Name ()
4343)
4444
4545func setDefaultDir (parent , role , port string , field reflect.Value ) {
@@ -63,7 +63,7 @@ func findField(v reflect.Value, fieldName string) (int, bool) {
6363
6464// Skip global/monitored/job options
6565func isSkipField (field reflect.Value ) bool {
66- if field .Kind () == reflect .Ptr {
66+ if field .Kind () == reflect .Pointer {
6767 if field .IsZero () {
6868 return true
6969 }
@@ -321,7 +321,7 @@ func (s *Specification) platformConflictsDetect() error {
321321
322322 platformStats := map [string ]conflict {}
323323 topoSpec := reflect .ValueOf (s ).Elem ()
324- topoType := reflect .TypeOf ( s ). Elem ()
324+ topoType := reflect .TypeFor [ Specification ] ()
325325
326326 for i := 0 ; i < topoSpec .NumField (); i ++ {
327327 if isSkipField (topoSpec .Field (i )) {
@@ -393,7 +393,7 @@ func (s *Specification) portConflictsDetect() error {
393393 portStats := map [usedPort ]conflict {}
394394 uniqueHosts := set .NewStringSet ()
395395 topoSpec := reflect .ValueOf (s ).Elem ()
396- topoType := reflect .TypeOf ( s ). Elem ()
396+ topoType := reflect .TypeFor [ Specification ] ()
397397
398398 for i := 0 ; i < topoSpec .NumField (); i ++ {
399399 if isSkipField (topoSpec .Field (i )) {
@@ -506,7 +506,7 @@ func (s *Specification) dirConflictsDetect() error {
506506 )
507507
508508 topoSpec := reflect .ValueOf (s ).Elem ()
509- topoType := reflect .TypeOf ( s ). Elem ()
509+ topoType := reflect .TypeFor [ Specification ] ()
510510
511511 for i := 0 ; i < topoSpec .NumField (); i ++ {
512512 if isSkipField (topoSpec .Field (i )) {
@@ -757,7 +757,7 @@ func setDMCustomDefaults(globalOptions *GlobalOptions, field reflect.Value) erro
757757 return err
758758 }
759759 field .Set (ref .Elem ())
760- case reflect .Ptr :
760+ case reflect .Pointer :
761761 if err := setDMCustomDefaults (globalOptions , field .Elem ()); err != nil {
762762 return err
763763 }
0 commit comments