Closed khanakia closed 3 years ago
I am using this code and getting Error Email must be a valid email address so it seems not working for custom domains ?
func Validate() { errors := validation.ValidateStruct(&a, validation.Field(&a.ID, validation.Required), validation.Field(&a.Email, validation.Required, is.Email), ) fmt.Println(errors) }
I think this is related to https://github.com/asaskevich/govalidator/pull/382
Can you update the govalidator package into your module so issue can fixed ?
I tested the govalidator package and it's working good. So please fix the issue ASAP my application is dependent on your package.
Working Playground: https://play.golang.org/p/Dao-5eF-ZMR
package main import "github.com/asaskevich/govalidator" func main() { type User struct { Email string `valid:"email"` } result, err := govalidator.ValidateStruct(User{"john@doe.ca"}) if err != nil { println("error: " + err.Error()) } println(result) }
I figured it out isEmail do the MX lookup and fails.
isEmail
I used validation.Field(&a.Email, validation.Required, is.EmailFormat) and it works great.
validation.Field(&a.Email, validation.Required, is.EmailFormat)
I am using this code and getting Error Email must be a valid email address so it seems not working for custom domains ?
I think this is related to https://github.com/asaskevich/govalidator/pull/382
Can you update the govalidator package into your module so issue can fixed ?
I tested the govalidator package and it's working good. So please fix the issue ASAP my application is dependent on your package.
Working Playground: https://play.golang.org/p/Dao-5eF-ZMR