# Go quickstart This is a ~60-second round-trip through a local `file://` store: compute a snapshot ID, push a directory, then pull it back and confirm the ID is unchanged. Snapshot IDs are 64-character lowercase hex strings, bit-identical to the CLI and every other binding. ## 1. Install Add the module and build the native `snapdir-ffi` artefacts — see [Install snapdir for Go](/install/go/) for the full recipe: ```sh go get github.com/snapdir/snapdir/bindings/go@v1.11.0 ``` ## 2. Snapshot + push The store URI is always an argument. With no setup, use a local `file://` store under the current directory: ```go package main import ( "context" "fmt" "log" "os" "path/filepath" snapdir "github.com/snapdir/snapdir/bindings/go" ) func main() { ctx := context.Background() cwd, err := os.Getwd() if err != nil { log.Fatal(err) } store := "file://" + filepath.Join(cwd, "store") // Compute the snapshot ID for a directory (64-char lowercase hex). id, err := snapdir.ID(ctx, "./my-dir", nil) if err != nil { log.Fatal(err) } fmt.Println("id: ", id) // Push the directory to the store; returns the same snapshot ID. sid, err := snapdir.Push(ctx, "./my-dir", store) if err != nil { log.Fatal(err) } fmt.Println("push:", sid) } ``` This prints the 64-hex snapshot ID twice — `snapdir.ID` and `snapdir.Push` agree. ## 3. Pull it back Pull the snapshot into a fresh directory, then re-compute its ID to prove the round-trip is lossless: ```go dest := "./restored" if err := snapdir.Pull(ctx, sid, store, dest); err != nil { log.Fatal(err) } back, err := snapdir.ID(ctx, dest, nil) if err != nil { log.Fatal(err) } fmt.Println("back:", back) // == sid ``` The `back` value equals `sid` — and it is the exact same snapshot ID you would get from `snapdir id` / `snapdir push` on the command line.