Description

Can not bind form-data request with custom struct that have two int fields Gin Can not bind form-data request with custom struct that have two int fields

but one int fileld is normal Gin Can not bind form-data request with custom struct that have two int fields

type UserPage struct {
    Name   string `form:"name" json:"name" binding:"required"`
    Gender string `form:"gender" json:"gender" binding:"required"`
    Size   int    `form:"size" json:"size" binding:"required"`
    Num    int    `form:"num" json:"num" binding:"required"`
}

Environment

  • go version: 1.18.2
  • gin version (or commit ref): v1.7.7
  • operating system: win10

Comment From: wangzhen94

it's ok, my code wrong