-
Notifications
You must be signed in to change notification settings - Fork 663
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
Might be a bug in the example custom-validation #29
Comments
I encountered the same problem |
due to [email protected] import gopkg.in/go-playground/validator.v9
it works. |
thank you replay发自我的华为手机-------- 原始邮件 --------发件人: 陈圆 <[email protected]>日期: 2020年3月10日周二 傍晚5:30收件人: gin-gonic/examples <[email protected]>抄送: burningceramicsinmesary <[email protected]>, Comment <[email protected]>主 题: Re: [gin-gonic/examples] Might be a bug in the example custom-validation (#29)due to [email protected] import gopkg.in/go-playground/validator.v9
so I solved this problem like this:
custom-validation/server.go
//"github.com/go-playground/validator/v10"
"gopkg.in/go-playground/validator.v9"
...
CheckIn time.Time `form:"check_in" binding:"required,bookabledate" time_format:"2006-01-02"`
it works.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.
|
@dasheyuan Can you please post a more details? Update: nvm, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, in the example Custom validators,
(
examples/custom-validation/server.go
Line 32 in 3a0d22a
v, ok := binding.Validator.Engine().(*validator.Validate)
returns v=nil and ok=false on my machine. Therefore the validatorbookableDate
would not be registered.Environment:
Windows 10
Go 1.13
github.com/gin-gonic/gin v1.5.0
github.com/go-playground/validator/v10 v10.2.0
The text was updated successfully, but these errors were encountered: