I would like to ask the iris framework of golang to parse the form into the structure. can you continue to parse when there are values in the form that do not exist in the structure?

problem description

golang"s iris framework parses the form into the structure and stops parsing when there are values in the form that do not exist in the structure

the environmental background of the problems and what methods you have tried

the recently written project uses the readform method of the iris framework to read the form. The current side passes the admin_id field (the field is not in the predefined structure). After parsing to this field, iris stops parsing and returns an error

related codes

/ / Please paste the code text below (do not replace the code with pictures)

type addForm struct {
    DeviceCode      string  `form:"device_code" validate:"required"`
    Name            string  `form:"name" validate:"required"`
    TypeID          int64   `form:"type_id" validate:"required,numeric"`
    TreeID          int64   `form:"tree_id" validate:"required,numeric"`
    ModelID         int64   `form:"model_id" validate:"omitempty,numeric"`
    Mrl             string  `form:"mrl" validate:"-"`
    PurchaseTime    string  `form:"purchase_time" validate:"-"`
    DeployTime      string  `form:"deploy_time" validate:"-"`
    DirectionType   int64   `form:"direction_type" validate:"omitempty,oneof=1 2 3"`
    IsCached        int64   `form:"is_cached" validate:"omitempty,oneof=0 1"`
    RelayController int64   `form:"relay_controller" validate:"omitempty,oneof=0 1"`
    Port            int64   `form:"port" validate:"omitempty,numeric"`
    Channels        int64   `form:"channels" validate:"omitempty,numeric,gt=0"`
    Threshold1      float64 `form:"threshold1" validate:"omitempty,numeric"`
    Threshold2      float64 `form:"threshold2" validate:"omitempty,numeric"`
    IsRestOpen      int64   `form:"is_rest_open" validate:"omitempty,oneof=1 2"`
    FunctionType    int64   `form:"function_type" validate:"omitempty,numeric"`
    Uri             string  `form:"uri" validate:"omitempty,url"`
}

var formParam addForm // 
var errP errs.Error   // 

// 
if err := ctx.ReadForm(&formParam); err != nil {

}
// 
var admin backend.Admin
if functions.ReadForm(&admin, ctx.Request().PostForm) != nil || admin.Valid() != nil {
    ctx.JSON(backend.Response(iris.Map{consts.CODE: errs.ERR_PARAM_WRONG}))
    return
}

what result do you expect? What is the error message actually seen?

iris automatically skips when parsing to a field that does not exist. The actual iris ends parsing directly and returns an error when parsing to the point that the field does not exist in the structure
.

Mar.30,2022

can be solved using iris.IsErrPath:

import (
    "github.com/kataras/iris"


// 
    if err := c.Ctx.ReadForm(&listAct); err != nil && !iris.IsErrPath(err) {
        
    }

the official issues has solved this problem
https://github.com/kataras/ir...

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb5a42-69ce1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb5a42-69ce1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?