Go 1.11 Gets Support On Google Clouds

Google Cloud recently announced the Go support on Cloud Functions.

Google Cloud has announced that the Go support will now be available on Cloud Functions. Currently, in beta, the runtime makes use of the most recent version, i.e., Go 1.11 which includes new language features such as modules for integrating third-party dependencies into the code.
The company says that from now on, the developers will be able to write Go functions that can be scaled dynamically in response to the load, and will integrate smoothly with Google Cloud events. The runtime supports a comprehensive ecosystem of Go packages via Go modules.
There are two groups of functions, i.e., HTTP functions and Background functions, that are allowed to be used with Cloud Functions.
The official blog explains that HTTP functions can be reached without an additional API gateway layer since Cloud Functions provides you an HTTPS URL. And once the function gets deployed, users are able to invoke the function by entering the URL into the browser.
In contrast, background functions are set off in response to an event. For example, you can develop a function that needs to run every time the contents of a Cloud Storage bucket change.
  1. // function.go  
  3. // Package function includes an example of processing a GCS event.  
  4. package function  
  6. import (  
  7.         "context"  
  8.         "log"  
  9. )  
  11. // GCSEvent holds event data from a Google Cloud Storage Event.  
  12. type GCSEvent struct {  
  13.         Bucket      string `json:"bucket"`  
  14.         Name        string `json:"name"`  
  15. }  
  17. func F(ctx context.Context, e GCSEvent) error {  
  18.         log.Printf("Processing file: %s", e.Name)  
  19.         return nil  
  20. }  
Source: Google
Here, when a user is deploying his/her function, he/she is also indicating a certain Cloud Storage bucket. As a result, every time a new file appears in that bucket, the function runs and logs the file’s name.
According to the company, with Cloud Functions, users can create serverless application back-ends, chatbots, video or image analysis solutions, and real-time data processing pipelines among many.
Environment variables are now generally available in Cloud Functions and the company has also added new IAM security controls, as recent improvements.