Up and running fast with Go SDK for Oracle Cloud Infrastructure — Docker
This article describes an easy approach to get going with the Go SDK for Oracle Cloud Infrastructure — using the oci-go Docker image. Using a Docker container image and a simple configuration file, oci commands can be executed without locally having to install and update the OCI Go SDK on your local environment. You have to love Docker and its ability to encapsulate mundane error prone documentation steps!
The OCI Go SDK is here along with the general install doc here, this describes what is encapsulated in the docker Dockerfile here (similar to the OCI CLI docker image defined here and Python Docker here). With docker its as easy as pulling/building the image and running a container and passing your OCI Go script.
Checkout the README.md file it has instructions for getting the docker image built and then you can run with an alias, with mounts (~/.oci for OCI config and PWD/current working directory for scripts) you can run scripts stored on the host using the docker container and use your host .oci/config file for authentication information for connecting to OCI.
For example the example.go script can be run using the alias with a simple invocation;
ocigo example.go
Easily execute your local Go scripts, there are lots of examples at this location https://github.com/oracle/oci-go-sdk/tree/master/example
Simple and easy to get going.
Resources
OCI Go SDK Documentation — https://docs.cloud.oracle.com/en-us/iaas/Content/API/SDKDocs/gosdk.htm
GitHub repo for OCI Go Docker — https://github.com/davidallan/oci-dockers/tree/master/go
OCI Go Examples — check it out- https://github.com/oracle/oci-go-sdk/tree/master/example