Clone this repository into your go path: git clone https://github.com/Muzosh/liboqs-go $GOPATH/src/github.com/Muzosh/liboqs-go
On the system, where Go code will be compiled, build LibOQS (you can use build-liboqs.sh script from this repository) or if already built, specify its location by export LIBOQS_ROOT=/path/to/liboqs
In your Go code use: import "github.com/Muzosh/liboqs-go/oqsgo" and then oqsgo.XY()
Before building or running the Go code, export these environment variables:1
export LIBOQS_ROOT="CHANGE_ME: <path-to-liboqs-repo>"
export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$LIBOQS_ROOT/build/lib" # only for macOS
export CGO_CPPFLAGS="-I$LIBOQS_ROOT/build/include"
export CGO_LDFLAGS="-L$LIBOQS_ROOT/build/lib -loqs"
Go modules approach
Get the module: go get github.com/Muzosh/liboqs-go/oqsgo
In your Go code use: import "github.com/Muzosh/liboqs-go/oqsgo" and then oqsgo.XY()
If you don't have libOQS on the system, clone and build it wherever you like: