INNER CODE UNIT · Go

targetRefField

nginx/nginx-gateway-fabric · apis/policygen.go:112

func targetRefField(structType *ast.StructType) (singleRef, found bool) {
	for _, field := range structType.Fields.List {
		for _, name := range field.Names {
			switch name.Name {
			case "TargetRef":
				return true, true
			case "TargetRefs":
				return false, true
			}
		}
	}
	return false, false
}

// extractPolicies parses each file in filePaths and returns the PolicyData for found resources.
func extractPolicies(filePaths []string) ([]PolicyData, error) {
	fset := token.NewFileSet()
	var policies []PolicyData

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…