Skip to content

Commit

Permalink
[client][go] avoid duplicated reflect imports (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal authored and wing328 committed Sep 6, 2019
1 parent 458d47b commit c7d4a96
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
boolean addedOptionalImport = false;
boolean addedTimeImport = false;
boolean addedOSImport = false;
boolean addedReflectImport = false;
for (CodegenOperation operation : operations) {
for (CodegenParameter param : operation.allParams) {
// import "os" if the operation uses files
Expand All @@ -391,8 +392,9 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
}

// import "reflect" package if the parameter is collectionFormat=multi
if (param.isCollectionFormatMulti) {
if (!addedReflectImport && param.isCollectionFormatMulti) {
imports.add(createMapping("import", "reflect"));
addedReflectImport = true;
}

// import "optionals" package if the parameter is optional
Expand Down

0 comments on commit c7d4a96

Please sign in to comment.