Skip to content
Node: zod, joigithub.com/sahilkhaire/gox/validate

MustValidate

Overview

MustValidate panics if validation fails.

Part of the validate package — Node.js analog: zod, joi.

Signature

go
func MustValidate(v any)

Compare: Node.js · Standard Go · gox

js
// Typical zod, joi pattern in Node.js
go
// use github.com/go-playground/validator struct tags or manual checks
go
import "github.com/sahilkhaire/gox/validate"

validate.MustValidate(signup{Email: "a@b.com", Age: 21})

Example

go
import "github.com/sahilkhaire/gox/validate"

validate.MustValidate(signup{Email: "a@b.com", Age: 21})

Tips

Import github.com/sahilkhaire/gox/validate and call MustValidate directly. See the comparison below for the standard library equivalent.

Standard library alternative

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

Back to validate package overview

MIT Licensed · Built for Node.js developers moving to Go