Skip to content

Commit

Permalink
HW09 is completed. work on mistakes 2
Browse files Browse the repository at this point in the history
  • Loading branch information
DimVlas authored and DimVlas committed Dec 25, 2024
1 parent 2b97504 commit 800448e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
6 changes: 1 addition & 5 deletions hw09_struct_validator/rules/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ var (

var (
// программные ошибки функций валидации.
// // правило применимо только к строкам
// ErrOnlyStringRule = errors.New("rule applies only to the string")
// // правило применимо только к целым
// ErrOnlyIntRule = errors.New("rule applies only to the int")
// недопустимое условие для правила.
ErrInvalidCond = errors.New("invalid condition for the rule")
// ошибка компиляции регулярного выражения.
Expand All @@ -40,7 +36,7 @@ var (
var (
// целое не может быть меньше условия.
ErrIntCantBeLess = errors.New("cannot be less")
// целое не может быть меньше больше.
// целое не может быть больше условия.
ErrIntCantBeGreater = errors.New("cannot be greater")
// целое на входит в список.
ErrIntNotInList = errors.New("int is not in the list")
Expand Down
12 changes: 0 additions & 12 deletions hw09_struct_validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,6 @@ import (
r "github.com/DimVlas/otus_hw/hw09_struct_validator/rules"
)

// implemented in errors.go file
// type ValidationError struct {
// Field string
// Err error
// }

// type ValidationErrors []ValidationError

// func (v ValidationErrors) Error() string {
// panic("implement me")
// }

func Validate(v interface{}) error {
// nothing to validate
if v == nil {
Expand Down
1 change: 0 additions & 1 deletion hw09_struct_validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/stretchr/testify/require"
)

// Test the function on different structures and other types.
type (
UserRole string

Expand Down

0 comments on commit 800448e

Please sign in to comment.