Menu

1 / 2

validatorgo v1.0.0 is here πŸŽ‰ β€” the validator.js you've been missing in Go

DEV CommunityΒ·Gbubemi AttahΒ·6 months ago
#qJn2Id9N
#why#go#opensource#webdev#validator
Reading 0:00
15s threshold

I started this library as an internal dependency for something else I was building (a Gin middleware library modeled on express-validator ). What I needed was simple: functions that take a string and tell me whether it's a valid email, IBAN, MongoDB ID, whatever. What I found in the Go ecosystem didn't quite fit, so I started writing them myself.

That "small dependency" grew teeth. Today it's 89 validators and a sanitizer subpackage, and stable enough that I'm tagging v1.0.0 and putting it out there properly. If you've ever missed validator.js while writing Go, that's pretty much what this is.

Repo: github.com/bube054/validatorgo

Why I bothered

Go has solid validation libraries. I'm not knocking them. But most of them are built around structs and tags:

type User struct { Email string `validate:"required,email"` }

Enter fullscreen mode

Exit fullscreen mode

Which is fine for HTTP handlers.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.