Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions sdks/go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Moss Go SDK

The Go work now has the same two-layer direction as the other Moss SDKs:

- `sdks/go/sdk/` contains the public Go SDK
- `sdks/go/bindings/` wraps the native `libmoss` runtime via CGO

Current status:

- bindings-backed manage operations for mutations and metadata reads
- local `LoadIndex` / `UnloadIndex` / local `Query` via `libmoss`
- examples and unit tests
- env-gated integration test scaffold

Important note:

- all runtime operations require the `libmoss` C SDK plus `-tags libmoss`

The public SDK module lives under [`sdks/go/sdk/`](./sdk/), and the native
bindings module lives under [`sdks/go/bindings/`](./bindings/).
41 changes: 41 additions & 0 deletions sdks/go/bindings/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Moss Go Bindings

This package wraps the native `libmoss` runtime for Go via CGO.

It mirrors the role of the other language bindings packages in this repository:

- native runtime access
- local index loading
- local query execution
- cloud-backed manage operations exposed through the native client

## Status

The real bindings implementation is compiled only with the `libmoss` build tag.
Without that tag, this package builds a stub that returns a clear
`ErrBindingsUnavailable` error.

## Local build workflow

Download the matching `libmoss` C SDK release archive for your platform from:

- <https://github.com/usemoss/moss/releases/tag/c-sdk-v0.9.0>

For Linux `x86_64`, extract the archive somewhere local so you have:

```text
<sdk-root>/
├── include/libmoss.h
└── lib/libmoss.so
```

Then build with:

```bash
export CGO_CFLAGS="-I<sdk-root>/include"
export CGO_LDFLAGS="-L<sdk-root>/lib"
export LD_LIBRARY_PATH="<sdk-root>/lib"
go test -tags libmoss ./...
```

The Go SDK module can then be built with the same flags and tag.
5 changes: 5 additions & 0 deletions sdks/go/bindings/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package mosscore

import "errors"

var ErrBindingsUnavailable = errors.New("mosscore: libmoss bindings are unavailable; build with -tags libmoss and configure the libmoss C SDK")
3 changes: 3 additions & 0 deletions sdks/go/bindings/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/usemoss/moss/sdks/go/bindings

go 1.22.2
Loading
Loading