title: How to send in REST response excel file in go with swagger?
body: <p>I'm trying to send in response excel file, but in it I get binary data. If try use reponse data as xlsx file, Excel show that it is corrupted. However if save it locally, everything is fine. For create xlsx file I'm using tealeg/xlsx. What am I doing wrong?</p>
  
  <p>Go:</p>
  
  <pre><code>file := xlsx.NewFile()
  ...
  // filling file with data
  ...
  // works fine
  err = file.Save("asd.xlsx")
  if err != nil {
      fmt.Printf(err.Error())
  }
  // something went wrong
  buffer := new(bytes.Buffer)
  if err := file.Write(buffer); err != nil {
      return nil, err
  }
  r := bytes.NewReader(buffer.Bytes())
  cr := ioutil.NopCloser(r)
  </code></pre>
  
  <p>Swagger:</p>
  
  <pre><code>get:
        tags:
          - "Report"
        summary: ""
        description: ""
        consumes:
          - "application/json"
        produces:
          - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        responses:
          200:
            description: ""
            schema:
              type: file
  </code></pre>