I think your example is not working.
alphanumspace is better
Title: "My Example Post" has spaces, so ValidateStruct returns err
type Post struct {
Title string `valid:"alphanum,required"`
Message string `valid:"duck,ascii"`
Message2 string `valid:"animal(dog)"`
AuthorIP string `valid:"ipv4"`
Date string `valid:"-"`
}
post := &Post{
Title: "My Example Post",
Message: "duck",
Message2: "dog",
AuthorIP: "123.234.54.3",
}
I think your example is not working. alphanumspace is better Title: "My Example Post" has spaces, so ValidateStruct returns err