Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting multiple error message #1

Open
derit opened this issue Aug 24, 2020 · 1 comment
Open

Getting multiple error message #1

derit opened this issue Aug 24, 2020 · 1 comment

Comments

@derit
Copy link

derit commented Aug 24, 2020

if the field is multiple required but not show all message only one message

for example

type User struct {
	Mobile   string `gopass:"required|numeric|length:11"` // 手機
	Password string `gopass:"required|length:6,16"`       // 密碼demo.go
	Email    string `gopass:"required|email"`             // Email
	Sex      string `gopass:"in:man,woman,other"`         // sex
}

var u = User{
		Mobile:   "13800138000",
		Password: "123456",
		Email:    "",
		Sex:      "",
	}

	v := gopass.NewGov(&gopass.Option{DefaultLanguage: "en_us"})

	err := v.ValidateStruct(&u)

	if err != nil {
		fmt.Println("get err:", err )
	} else {
		fmt.Println("struct test pass")
	}

in this code only show one error

err: param Email needed
@fizzday
Copy link
Member

fizzday commented Oct 28, 2020

@derit yeah, if detected one error , will be return directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants