Project structure for large Go project (golang)


#1

I’m wanting to write a fairly large project in Go using the Serverless Framework and I have some questions about how to organize my project. I’m planning to break up the project into several smaller services that will be responsible for different parts of the site and can be mounted at /something on a single API Gateway domain.

When I generated a new project using the golang template, I noticed that each function gets compiled into a stand-alone binary but that all the binaries are uploaded in the zip file. So, in the standard template, you have a “hello” function and a “world” function and the zip file upload is already over 5MB. It seems like this is not optimal and you could rather quickly hit the 50MB limit on zip uploads.

How would you recommend organizing a golang project that will eventually have 100s of endpoints/functions, but need to share resources?


#2

Well, I guess I should start with individually packaging each function. That’ll make more sense with large binaries.