package errs import "fmt" type ValidationError struct { field string message string } func (e *ValidationError) Error() string { return fmt.Sprintf("字段 %s: %s", e.field, e.message) } func NewValidationError(field, message string) error { return &ValidationError{ field: field, message: message, } }