Right now, in serverless you have to use the binary runtime in order to use Golang.
Native / Docker runtime in Openwhisk (which is binary in serverless) does not re use variables outside of the main function. This is usually used to reuse db connection. See https://github.com/apache/openwhisk/issues/5044
Use case description
Openwhisk has a Golang runtime which is better for development in Golang. See https://www.ibm.com/cloud/blog/announcements/ibm-cloud-functions-adds-native-support-for-go-1-11
Right now, in serverless you have to use the binary runtime in order to use Golang.
Native / Docker runtime in Openwhisk (which is binary in serverless) does not re use variables outside of the main function. This is usually used to reuse db connection. See https://github.com/apache/openwhisk/issues/5044