refactor: replace gperr.Builder with gperr.Group for concurrent error handling

- Updated various files to utilize gperr.Group for cleaner concurrency error handling.
- Removed sync.WaitGroup usage, simplifying the code structure.
- Ensured consistent error reporting across different components.
This commit is contained in:
yusing
2026-01-06 16:29:35 +08:00
parent 724617a2b3
commit 424398442b
9 changed files with 62 additions and 70 deletions

View File

@@ -86,7 +86,7 @@ func initPtr(dst reflect.Value) {
}
func ValidateWithFieldTags(s any) gperr.Error {
errs := gperr.NewBuilder()
var errs gperr.Builder
err := validate.Struct(s)
var valErrs validator.ValidationErrors
if errors.As(err, &valErrs) {
@@ -302,7 +302,7 @@ func mapUnmarshalValidate(src SerializedObject, dstV reflect.Value, checkValidat
// convert target fields to lower no-snake
// then check if the field of data is in the target
errs := gperr.NewBuilder()
var errs gperr.Builder
switch dstV.Kind() {
case reflect.Struct, reflect.Interface:
@@ -457,7 +457,7 @@ func Convert(src reflect.Value, dst reflect.Value, checkValidateTag bool) gperr.
if dstT.Kind() != reflect.Slice {
return ErrUnsupportedConversion.Subject(dstT.String() + " to " + srcT.String())
}
sliceErrs := gperr.NewBuilder()
var sliceErrs gperr.Builder
i := 0
gi.ReflectInitSlice(dst, srcLen, srcLen)
for j, v := range src.Seq2() {
@@ -541,7 +541,7 @@ func ConvertString(src string, dst reflect.Value) (convertible bool, convErr gpe
if !isMultiline && src[0] != '-' {
values := strutils.CommaSeperatedList(src)
gi.ReflectInitSlice(dst, len(values), len(values))
errs := gperr.NewBuilder()
var errs gperr.Builder
for i, v := range values {
_, err := ConvertString(v, dst.Index(i))
if err != nil {