Go returns a corrupted file on vps

Here is my code
https://play.golang.org/p/HZT6pEsYJF2

It should just create a file, fill a column with a value and return it.

If I test it on localhost, the excel file is correct
But if I deploy it to a vps, the file returned is broken
Any idea what might be wrong?
Here is the curl I am using for the post request:
curl -X POST http://localhost:8080 --output file.xlsx

Thanks

Your code works fine for me. I’ve deployed the compiled binary at my VPS. You cann access it as https://www.lhorn.de/file.xlsx

Can you share the URL to your VPS?

interesting.
here is the curl I am using to my vps
curl -X POST http://167.99.247.248:8080 --output file.xlsx

Why do you POST? Your code works for GET, too.

What I find strange is that your deployment and my deployment return files that have different file types. Your original code as deployed on my VPS produces a file that is identified as Microsoft OOXML. But the file returned by your deployment is identified as Microsoft Excel 2007+.

How did you build the binary you run on your VPS? Did you build it locally and copied it to the VPS? Or did you build it on the VPS using Go there?

as I want to post the data in a json file, and get the output in the excel file

wow, that is strange - will look into it

actually I have not even built it yet- its just go run main.go on my vps at the moment

by the way- is your vps running on linux?

Yes, Ubuntu 16.04.4 LTS.

in the end, the only issue I had that on both my VPS-es I had go 1.6.
after updating it to 1.10, it works properly. thank you

1.6 is quite two years old, time to update.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.