In a recent post, Google has announced support for Go 1.11 on Cloud Functions, which is their Function as a Service offering. With this announcement, Go joins the line as a supported programming language for Cloud Functions besides the previously available Node.js and Python.
Go is an open source programming language designed at Google, and with the 1.11 version, they added modules as a concept. These modules manage the dependencies on third-party packages used in a Go project, comparative to NuGet for .NET and NPM for node.js. Surprisingly, even though Go comes from a Google background, Google Cloud Functions is not the first FaaS which offers support for the language, as IBM Cloud Functions and AWS Lambda already announced this support last year. Nonetheless, the community welcomes the support for the language, as they find it works well in combination with FaaS implementations.
Finally. Go is an excellent fit for cloud functions thanks to the quick startup time for function cold starts.
Tested a node.js & Golang function with db connection last year on lambda, 3148 ms vs. 1648 ms cold start.
Function as a Service is a popular concept, with all the major cloud vendors having an implementation thereof, be it Google Cloud Functions, Azure Functions or AWS Lambda. In general, functions run a piece of code whenever an event happens, and often implement parts of serverless architectures, as described by Matt Watson, founder and CEO at Stackify.
FaaS is the concept of serverless computing via serverless architectures. Software developers can leverage this to deploy an individual "function", action, or piece of business logic. They are expected to start within milliseconds and process individual requests and then the process ends.
Using Google Cloud Functions is no different and provides two different ways to start invocations. The first is HTTP functions, which are invoked using an HTTP request, and allow usage from any HTTP compatible client. On the other hand, there are background functions, which are triggered by an event, for example from Cloud Storage or Firebase. Through these events, it is possible to implement a variety of scenarios, of which the tutorials for Cloud Functions show several samples. Correspondingly, this includes applications such as searching the Google Knowledgebase from Slack or extracting and translating text from pictures.
Source: https://cloud.google.com/functions/docs/tutorials/ocr
There are already several posts out there showing how to start with Go on Cloud Functions, for example by Luke Freeman, the founder of Posse Productions. In this article, Freeman shows how to set up the structure for these types of projects, in which way to construct the functions, and how to test and consume them. Finally, the deployment process is described, giving a complete overview of the various development stages.