Why does serverless overwrite my go.mod on each build?


I started experimenting with Serverless and Go and so far I’m amazed at how easy things are. I like it!

The one thing that surprised me was that I had issues using my own packages. It turned out my that my module (I am using go mod) had an odd name that I hadn’t given it. I fixed the name, manually built my binaries and happily went on to make and deploy only to find that make fails. What? Another look showed me that the module name was back to the old value. A little while later the culprit was clear - the gomod.sh script overwrites the go.mod file on each execution of the make command.

My question: Why? Is there a reason for this that I do not see?

I fixed the issue for myself by adding a simple check in the script for the existence of go.mod, so I can continue experimenting. But I want to know more about this - maybe there is a specific reason for this behaviour.