diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 6e3b5481f8..6ca3a39324 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -102,7 +102,8 @@ func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{ {{#headerParams}} // header params "{{baseName}}" headerParams["{{baseName}}"] = {{paramName}} {{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}} -{{#formParams}}{{#isFile}} fbs, _ := ioutil.ReadAll(file) +{{#formParams}}{{#isFile}} + fbs, _ := ioutil.ReadAll(file) fileBytes = fbs fileName = file.Name(){{/isFile}} {{^isFile}} formParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}} diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index d4b05313c8..9130ec599b 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-05-01T14:37:06.925+01:00 +- Build date: 2016-05-02T15:51:26.331+01:00 - Build package: class io.swagger.codegen.languages.GoClientCodegen ## Installation diff --git a/samples/client/petstore/go/go-petstore/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go index aea3db2ba0..0e252159fd 100644 --- a/samples/client/petstore/go/go-petstore/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -551,7 +551,8 @@ func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File headerParams["Accept"] = localVarHttpHeaderAccept } - formParams["additionalMetadata"] = additionalMetadata fbs, _ := ioutil.ReadAll(file) + formParams["additionalMetadata"] = additionalMetadata + fbs, _ := ioutil.ReadAll(file) fileBytes = fbs fileName = file.Name()