作者 tangxvhui

更新error 输出

package utils
import (
"fmt"
timeconv "github.com/Andrew-M-C/go.timeconv"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"errors"
"math"
"reflect"
"strconv"
"strings"
"time"
timeconv "github.com/Andrew-M-C/go.timeconv"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// ValidateCommand 验证输入参数
... ... @@ -25,12 +26,12 @@ func ValidateCommand(commandType interface{}) error {
field, isExist := elem.FieldByName(validErr.Field)
if isExist {
if tag := field.Tag.Get("cname"); len(tag) > 0 {
return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, tag, -1))
return errors.New(strings.Replace(validErr.Message, validErr.Field, tag, -1))
} else {
return fmt.Errorf(validErr.Message)
return errors.New(validErr.Message)
}
} else {
return fmt.Errorf(validErr.Message)
return errors.New(validErr.Message)
}
}
}
... ...