New Golang Validator Package Is In Community, No Struct Tags!

Hey folks!

Recently I published a new Golang Validator package called GoValidator.

Github: https://github.com/rezakhademix/govalidator

It have some features, like:

  1. No need of struct tags
  2. No Type reflection
  3. You can define any custom rules
  4. Super light!

It will help you handle your project data sanitizing easily.

I would be delighted if you were interested in helping me improve the GoValidator package and your opinions about this package are welcome

Being lightweight is a plus, especially for projects where performance is critical.

1 Like

You could clean up the syntax by making the custom error message optional. Like this: v.MaxInt(v.Name, "First Name", 20).WithErrMessage("my custom message")
This would make for clean calls without all these unneeded empty strings everywhere.

And another big case would be i21n, if you truly want to generate error messages for the end user, they should be easy to translate. This could be done in different ways: One way would be typed errors including the syntax for replacement.
Or you could export a Method, where one can provide a map[language]ErrorMessages and the current language, so the error messages are taken from the map for the fitting language code.

2 Likes

Thanks for your recommendation and your time. Definitely, I will consider them. Right now, It’s just a baby and it will grow soon!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.