Skip to content

Commit c7d4a96

Browse files
qmuntalwing328
authored andcommitted
[client][go] avoid duplicated reflect imports (#3847)
1 parent 458d47b commit c7d4a96

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
374374
boolean addedOptionalImport = false;
375375
boolean addedTimeImport = false;
376376
boolean addedOSImport = false;
377+
boolean addedReflectImport = false;
377378
for (CodegenOperation operation : operations) {
378379
for (CodegenParameter param : operation.allParams) {
379380
// import "os" if the operation uses files
@@ -391,8 +392,9 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
391392
}
392393

393394
// import "reflect" package if the parameter is collectionFormat=multi
394-
if (param.isCollectionFormatMulti) {
395+
if (!addedReflectImport && param.isCollectionFormatMulti) {
395396
imports.add(createMapping("import", "reflect"));
397+
addedReflectImport = true;
396398
}
397399

398400
// import "optionals" package if the parameter is optional

0 commit comments

Comments
 (0)