Skip to content

Commit

Permalink
derp
Browse files Browse the repository at this point in the history
  • Loading branch information
cneill committed Sep 13, 2023
1 parent 48bfe0f commit b1212ac
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ func (f Field) SliceType() string {
return fmt.Sprintf("[]*%s", f.Name())
}

sliceType := getSliceType(f.rawValue)

return fmt.Sprintf("[]%s", sliceType)
return getSliceType(f.rawValue)
}

func getSliceType(input any) string {
Expand Down Expand Up @@ -145,7 +143,7 @@ func getSliceType(input any) string {
if kind == reflect.Slice {
itemType = getSliceType(idxVal.Interface())
} else {
itemType = fmt.Sprintf("[]%s", idxType.String())
itemType = idxType.String()
}

// we have encountered multiple types for this field, have to accept anything
Expand All @@ -158,7 +156,7 @@ func getSliceType(input any) string {
sliceType = itemType
}

return sliceType
return fmt.Sprintf("[]%s", sliceType)
}

// Value returns the string version of RawValue.
Expand Down

0 comments on commit b1212ac

Please sign in to comment.