mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-18 15:23:51 +01:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user