Skip to content

Commit

Permalink
Remove commented out code and add debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
ronensc committed Aug 24, 2022
1 parent 734f8e4 commit 4d46467
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/apitodoc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func iterate(output io.Writer, data interface{}, indent int) {
newIndent := indent + 1
dataType := reflect.ValueOf(data).Kind()
//dataTypeName := reflect.ValueOf(data).Type().String()
// DEBUG code: dataTypeName := reflect.ValueOf(data).Type().String()
d := reflect.ValueOf(data)
if dataType == reflect.Slice || dataType == reflect.Map {
// DEBUG code: fmt.Fprintf(output, "%s %s <-- %s \n",strings.Repeat(" ",4*indent),dataTypeName,dataType )
Expand All @@ -41,7 +41,6 @@ func iterate(output io.Writer, data interface{}, indent int) {
// DEBUG code: fmt.Fprintf(output,"%s %s <-- %s \n",strings.Repeat(" ",4*indent),dataTypeName,dataType )
for i := 0; i < d.NumField(); i++ {
val := reflect.Indirect(reflect.ValueOf(data))
// fieldName := val.Type().Field(i).Name
fieldName := val.Type().Field(i).Tag.Get(api.TagYaml)
fieldName = strings.ReplaceAll(fieldName, ",omitempty", "")

Expand Down Expand Up @@ -70,6 +69,7 @@ func iterate(output io.Writer, data interface{}, indent int) {
}
return
} else if dataType == reflect.Ptr {
// DEBUG code: fmt.Fprintf(output, "%s %s <-- %s \n", strings.Repeat(" ", 4*indent), dataTypeName, dataType)
elemType := reflect.TypeOf(data).Elem()
zeroElement := reflect.Zero(elemType).Interface()
// Since we only "converted" Ptr to Struct and the actual output is done in the next iteration, we call
Expand Down

0 comments on commit 4d46467

Please sign in to comment.