Skip to content

Commit 9acf534

Browse files
authored
refactor to use reflect.TypeFor (#2812)
1 parent 8493c61 commit 9acf534

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bind.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ func setFloatField(value string, bitSize int, field reflect.Value) error {
420420

421421
var (
422422
// NOT supported by bind as you can NOT check easily empty struct being actual file or not
423-
multipartFileHeaderType = reflect.TypeOf(multipart.FileHeader{})
423+
multipartFileHeaderType = reflect.TypeFor[multipart.FileHeader]()
424424
// supported by bind as you can check by nil value if file existed or not
425-
multipartFileHeaderPointerType = reflect.TypeOf(&multipart.FileHeader{})
426-
multipartFileHeaderSliceType = reflect.TypeOf([]multipart.FileHeader(nil))
427-
multipartFileHeaderPointerSliceType = reflect.TypeOf([]*multipart.FileHeader(nil))
425+
multipartFileHeaderPointerType = reflect.TypeFor[*multipart.FileHeader]()
426+
multipartFileHeaderSliceType = reflect.TypeFor[[]multipart.FileHeader]()
427+
multipartFileHeaderPointerSliceType = reflect.TypeFor[[]*multipart.FileHeader]()
428428
)
429429

430430
func isFieldMultipartFile(field reflect.Type) (bool, error) {

0 commit comments

Comments
 (0)