What’s happening with IBM Cloud Functions and Go?
I’m excited to announce that IBM Cloud Functions officially supports Go natively. Previously, we explained how to use Docker Actions in order to work with Go, but this was not native to Go developers. Now, Go developers can write a function and process the input and the output with normal function parameters and return values.
Ready to try it out?
You can deploy an example action by using the IBM Cloud CLI. Console UI support for Go is coming soon.
Here is a simple hello world action:
Create a web action with the IBM Cloud Functions CLI plugin. Note: As a best practice, always specify the kind when you use the CLI to be sure that you are working with the version of the language that you expect:
Next, get the URL for the web action and open it in your browser:
Compile for production
To avoid latency with cold starts, it’s recommended that you compile and deploy your Go Action executable. By doing so, the action doesn’t have to compile the code in the first invocation. Another benefit is that compiling your code allows you to use multiple source files and vendor dependency libraries.
To see how easy it is to set a project and compile and deploy your Go Action, check out the documentation.