refactor: replace gperr with standard errors package and simplify string parsing

- Replace gperr.Error return types with standard error across test files
- Replace gperr.New with errors.New in validation and serialization tests
- Update API documentation in README files to use error instead of gperr.Error
- Simplify string parsing using strings.Cut in docker/label.go
- Update benchmarks to use NewTestEntrypoint and remove task package dependency
This commit is contained in:
yusing
2026-02-10 16:59:19 +08:00
parent a0d0ad0958
commit 1579f490c0
11 changed files with 45 additions and 69 deletions

View File

@@ -1,23 +1,22 @@
package serialization
import (
"errors"
"reflect"
"testing"
gperr "github.com/yusing/goutils/errs"
)
type CustomValidatingPointerString string
func (c *CustomValidatingPointerString) Validate() gperr.Error {
func (c *CustomValidatingPointerString) Validate() error {
if c == nil {
return gperr.New("pointer string cannot be nil")
return errors.New("pointer string cannot be nil")
}
if *c == "" {
return gperr.New("string cannot be empty")
return errors.New("string cannot be empty")
}
if len(*c) < 2 {
return gperr.New("string must be at least 2 characters")
return errors.New("string must be at least 2 characters")
}
return nil
}