Boolean Validators for Go
Bool() supports True(), False(), EqualTo(), InSlice(), and
Passing().
v.Is(v.Bool(true, "active").True())v.Is(v.Bool(false, "active").Not().False())v.Is(v.Bool(true, "enabled").EqualTo(true))Pointer variant
Section titled “Pointer variant”BoolP() accepts *bool. Its callback receives the pointer, and it adds
Nil() and FalseOrNil().
var active *boolv.Is(v.BoolP(active, "active").Nil())v.Is(v.BoolP(active, "active").FalseOrNil())