INNER CODE UNIT · Go
structTypes
nginx/nginx-gateway-fabric · apis/policygen.go:69
func structTypes(f *ast.File) map[string]*ast.StructType {
types := make(map[string]*ast.StructType)
for _, decl := range f.Decls {
genDecl, ok := decl.(*ast.GenDecl)
if !ok || genDecl.Tok != token.TYPE {
continue
}
for _, spec := range genDecl.Specs {
typeSpec, ok := spec.(*ast.TypeSpec)
if !ok {
continue
}
structType, ok := typeSpec.Type.(*ast.StructType)
if !ok {
continue