The Go SDK is currently in Public Preview with version
5.0.0-go-preview.3. If you encounter any issues or need assistance, please contact Ditto Support.Adding the Ditto Go SDK to a Go Application
The Ditto Go SDK is available via a public GitHub repository: https://github.com/getditto/ditto-go-sdk/. In the directory containing your application’sgo.mod file, run these commands to add the Ditto Go SDK and its dependencies:
ditto package:
Go
Installing the Ditto Go SDK Native Library
A native library provides Ditto Edge Sync Platform functionality, and must be linked into any application that uses the Ditto Go SDK.Downloading and Unpacking the Ditto Library
DownloadDitto.tar.gz and unpack an archive containing the libdittoffi.so (Linux) or libdittoffi.dylib (macOS) shared library:
Linking to the Ditto Shared Library at Build Time
When you build your application that uses the Ditto Go SDK, the linker needs to be able to find the native library.Linux
The sharedlibdittoffi.so library will automatically be linked to by the Go SDK if it is in one of these locations:
/usr/local/lib/usr/lib
libdittoffi.so to one of these locations for automatic linking.
If your libdittoffi.so is located somewhere else, you can pass that path to go build via the -ldflags option when you build your application.
macOS
The sharedlibdittoffi.dylib library will automatically be linked to by the Go SDK if it is in one of these locations:
/usr/local/lib/usr/lib
libdittoffi.dylib to one of these locations for automatic linking.
If your libdittoffi.dylib is located somewhere else, you can pass that path to go build via the -ldflags option when you build your application.
Linking to the Ditto Shared Library at Run Time
When an app that uses the Ditto Go SDK is run, the system must be able to find and load the native library.Linux
Ubuntu/Debian will search in these directories at runtime by default:/lib/lib64/usr/lib/usr/lib64/usr/local/lib
libdittoffi.so library in one of those directories, set the LD_LIBRARY_PATH environment variable to the appropriate directory when running your application. For example:
macOS
macOS will search in these directories at runtime by default:/usr/lib/usr/local/lib
libdittoffi.dylib library in one of those directories, set the DYLD_LIBRARY_PATH environment variable to the appropriate directory when running your application. For example: