Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NaisCompare ¶
Example ¶
package main import ( "fmt" "github.com/nais/liberator/pkg/webhookvalidator" "k8s.io/apimachinery/pkg/util/validation/field" ) func main() { type Pet struct { // +nais:doc:Immutable=true Name string `nais:"key"` // +nais:doc:Immutable=true Species string `nais:"immutable"` } type Pets struct { Pets []Pet } new := Pets{ Pets: []Pet{ {Name: "Alberto", Species: "Dog"}, {Name: "Sansa", Species: "Bird"}, }, } old := Pets{ Pets: []Pet{ {Name: "Alberto", Species: "Dog"}, {Name: "Sansa", Species: "Cat"}, }, } err := webhookvalidator.NaisCompare(new, old, field.NewPath("animals")) fmt.Println(err) }
Output: animals.Pets.1.Species: Invalid value: "Bird": field is immutable
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.