Going serverless with Google Cloud Functions and Go 1.11
Looking for a serverless platform for your Go projects? Google Cloud now supports Go 1.11 on Cloud Functions. Take advantage of Go 1.11’s modules for your latest projects!
It’s always been a mystery how Google Cloud Functions and Go were both developed by Google, but they didn’t support each other. Now, that mismatch is over as Cloud Functions officially supports Go 1.11. This means more modules and other kind of fun stuff for developers!
Cloud Functions allows developers to run and scale code in the cloud without paying for servers when they don’t need ’em. Highly available and extremely scalable, Cloud Functions makes serverless computing easier than ever for developers. The use cases are pretty varied for Cloud Functions: serverless application backends, real-time, data processing pipelines, image analysis tools, and more.
With this language update, developers can utilize Go functions for their serverless apps. Right now, there are two kinds of functions developers can take advantage of with Cloud Functions: HTTP functions and background functions.
HTTP functions are invoked by HTTP requests. These functions follow the http.HandlerFunc type from the standard library. Additionally, they can be reached with an HTTPS URL without an additional API gateway layer. Developers can invoke the function with this URL after the function is deployed.
In comparison, background functions are simply triggered in response to an event. It’s pretty simple – just create a function that will run when a specific event occurs, and voila!
Developers can also take advantage of the wide variety of Go packages and modules for their Cloud Functions. There’s a rich ecosystem of community projects available to help extend your serverless application in new and exciting ways!
Getting Cloud Functions
While Go 1.11 is freely available here and on GitHub, Google Cloud Functions may come with a price tag. Cloud Functions does offer a free tier on their pricing plan. Experiment away with up to 2 million invocations a month, up to a million seconds of computing time, and 5 GB of internet traffic a month. However, if this sandbox is a little too small for your project, they have a number of tiers available for the level of data you need.