Skip to content

Commit

Permalink
go: add os import in case of File return type (#3996)
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido authored and wing328 committed Oct 1, 2019
1 parent 775d96c commit c8ac41c
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> o
boolean addedOSImport = false;
boolean addedReflectImport = false;
for (CodegenOperation operation : operations) {
// import "os" if the operation uses files
if (!addedOSImport && "*os.File".equals(operation.returnType)) {
imports.add(createMapping("import", "os"));
addedOSImport = true;
}
for (CodegenParameter param : operation.allParams) {
// import "os" if the operation uses files
if (!addedOSImport && "*os.File".equals(param.dataType)) {
Expand Down

0 comments on commit c8ac41c

Please sign in to comment.