INNER CODE UNIT · Go
main
nginx/nginx-gateway-fabric · apis/policygen.go:190
func main() {
// Flags to be included in the Makefile under generate-policies.
pkg := flag.String("package", "", "Target package name (eg: v1alpha1 or v1alpha2)")
outputFile := flag.String("output", "",
"name of the generated output file (eg: ~/v1alpha1/policy_methods.go)")
flag.Parse()
if *pkg == "" || *outputFile == "" {
log.Fatal("Error: both -package and -output flags are required")
}
targetDir := filepath.Dir(*outputFile)
policyFiles, err := findPolicyFiles(targetDir)
if err != nil {
log.Fatalf("Error: failed to find the policy files %v", err)
}