Which library

To this day, the most up to date library seems to be rana/ora

How to install (linux & macosx)

Download Oracle Instant Client for linux x64: both packages Basic and SDK Unzip each of them in the same folder /opt/oracle

mkdir -p /opt/oracle
cd /opt/oracle
unzip ~/Downloads/instantclient-basiclite-linux.x64-12.2.0.1.0.zip
unzip ~/Downloads/instantclient-sdk-linux.x64-12.2.0.1.0.zip
cd /opt/oracle/instantclient_12_1

Add the necessary env variables and paths:

# Oracle
export LD_LIBRARY_PATH=/opt/oracle/instantclient_12_2:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/opt/oracle
export ORACLE_HOME=$LD_LIBRARY_PATH

copy from the go package ./contrib/oci8.pc to /opt/oracle and modify its content to:

prefix=/opt/oracle/instantclient_12_2
version=12.2
build=client64

libdir=${prefix}
includedir=${prefix}/sdk/include

Name: oci8
Description: Oracle database engine
Version: ${version}
Libs: -L${libdir} -lclntsh
Libs.private:
Cflags: -I${includedir}

On linux

Follow the instructions from Oracle:

ln -s /opt/oracle/instantclient_12_2/libclntsh.so.12.1 /opt/oracle/instantclient_12_2/libclntsh.so
ln -s /opt/oracle/instantclient_12_2/libocci.so.12.1 /opt/oracle/instantclient_12_2/libocci.so

On macosx

Follow the instructions from Oracle:

ln -s /opt/oracle/instantclient_12_2/libclntsh.dylib.12.1 /opt/oracle/instantclient_12_2/libclntsh.dylib
ln -s /opt/oracle/instantclient_12_2/libocci.dylib.12.1 /opt/oracle/instantclient_12_2/libocci.dylib

One more step is necessary for macosx.

You have to add your machine name in your /etc/hosts for the 127.0.0.1

127.0.0.1 localhost YOURMACHINENAME

Install the package

go get -u cd gopkg.in/rana/ora.v4

You should be all good!