feat: 修复golint相关警告信息

This commit is contained in:
2025-12-26 12:01:52 +08:00
parent c23d938092
commit 1636a2652f
9 changed files with 21 additions and 25 deletions

View File

@@ -10,11 +10,13 @@ package request
import (
"bytes"
"errors"
"github.com/mcuadros/go-defaults"
"io"
"net/http"
"strings"
"git.zhangdeman.cn/zhangdeman/wrapper/op_array"
"github.com/mcuadros/go-defaults"
"github.com/go-playground/validator/v10"
"git.zhangdeman.cn/zhangdeman/gin/define"
@@ -44,11 +46,9 @@ func (f *form) Parse(ctx *gin.Context, receiver interface{}) error {
// 因为请求体被读一遍之后就没了,重新赋值 requestBody
ctx.Request.Body = io.NopCloser(bytes.NewReader(requestBody))
method := strings.ToUpper(ctx.Request.Method)
if method == http.MethodGet ||
method == http.MethodPatch ||
method == http.MethodTrace ||
method == http.MethodConnect ||
method == http.MethodOptions {
if op_array.ArrayType([]string{
http.MethodGet, http.MethodPatch, http.MethodTrace, http.MethodConnect, http.MethodOptions,
}).Has(method) >= 0 {
if err := ctx.ShouldBindQuery(receiver); nil != err {
return err
}