Skip to content

Commit 7ac69d7

Browse files
authored
fix: missing imports (#1637)
1 parent 7ec1cf2 commit 7ac69d7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

internal/codegen/golang/imports.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ func (i *importer) queryImports(filename string) fileImports {
310310
}
311311
}
312312
}
313-
if strings.HasPrefix(q.Ret.Type(), name) {
313+
retType := strings.TrimPrefix(q.Ret.Type(), "[]")
314+
if strings.HasPrefix(retType, name) {
314315
return true
315316
}
316317
}
@@ -323,7 +324,8 @@ func (i *importer) queryImports(filename string) fileImports {
323324
}
324325
}
325326
}
326-
if strings.HasPrefix(q.Arg.Type(), name) {
327+
argType := strings.TrimPrefix(q.Arg.Type(), "[]")
328+
if strings.HasPrefix(argType, name) {
327329
return true
328330
}
329331
}
@@ -418,7 +420,8 @@ func (i *importer) batchImports(filename string) fileImports {
418420
}
419421
}
420422
}
421-
if strings.HasPrefix(q.Ret.Type(), name) {
423+
retType := strings.TrimPrefix(q.Ret.Type(), "[]")
424+
if strings.HasPrefix(retType, name) {
422425
return true
423426
}
424427
}
@@ -431,7 +434,8 @@ func (i *importer) batchImports(filename string) fileImports {
431434
}
432435
}
433436
}
434-
if strings.HasPrefix(q.Arg.Type(), name) {
437+
argType := strings.TrimPrefix(q.Arg.Type(), "[]")
438+
if strings.HasPrefix(argType, name) {
435439
return true
436440
}
437441
}

0 commit comments

Comments
 (0)