Skip to content

Commit fbacd18

Browse files
committed
controllerbuilder: tolerate map[string]apiextensionsv1.JSON fields
1 parent 5937777 commit fbacd18

File tree

1 file changed

+3
-1
lines changed
  • dev/tools/controllerbuilder/pkg/gocode

1 file changed

+3
-1
lines changed

dev/tools/controllerbuilder/pkg/gocode/ast.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ func (p *Package) addStruct(name *ast.Ident, def *ast.StructType, comments []ast
213213
}
214214
structField.Type = goType
215215

216-
tokens := strings.Split(strings.TrimLeft(goType, "*[]"), ".")
216+
s := strings.TrimPrefix(goType, "map[string]")
217+
s = strings.TrimLeft(s, "*[]")
218+
tokens := strings.Split(s, ".")
217219
if len(tokens) > 1 {
218220
packageName := tokens[0]
219221
for _, imp := range p.Imports {

0 commit comments

Comments
 (0)