Install snapdir for Go

The Go binding wraps the same Rust core as the snapdir CLI through a CGo bridge, so the manifests and snapshot IDs it produces are bit-identical to every other binding. It is a build-from-source binding: you compile the snapdir-ffi C ABI from crates.io, generate its header with cbindgen, and let CGo link your program against the static library.

Install

Add the module from GOPROXY:

go get github.com/snapdir/snapdir/bindings/go@v1.11.0

Because this is a CGo package, the module is not self-contained: a plain go get without the native artefacts in place fails with linker errors. You must supply libsnapdir_ffi.a and snapdir.h, built from the published snapdir-ffi crate (crates.io). This needs a Rust toolchain and cbindgen:

# Build the C ABI static library from the snapdir-ffi source crate
cargo build --release -p snapdir-ffi --locked

# Generate the C header with cbindgen
cbindgen --config cbindgen.toml --crate snapdir-ffi --output snapdir.h .

# Drop the artefacts into the module (both dirs are gitignored, shipped by neither)
#   libsnapdir_ffi.a -> <module>/lib/
#   snapdir.h        -> <module>/include/

# Build with CGo enabled
CGO_ENABLED=1 go build ./...

The package sets its own #cgo directives (-I${SRCDIR}/include and -L${SRCDIR}/lib -lsnapdir_ffi -lpthread -ldl -lm), so once the two files are in place go build links them automatically.

Platform support

Every binding is CI-verified against its live public registry before release. The Go binding runs on Linux (glibc and Alpine/musl, x64 and arm64) and macOS. Windows is unsupported — snapdir is Unix-only.

Binding Linux glibc Linux musl (Alpine) macOS Windows
Go yes (x64 + arm64) yes (x64 + arm64) yes no

All bindings share this matrix except Java, which is glibc-only today (musl support is planned for 1.11.1).

Next