Skip to content
Merged
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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,43 @@ jobs:
- name: cargo clippy -p ordvec-ffi
run: cargo clippy -p ordvec-ffi --all-targets -- -D warnings

# ----------------------------------------------------------------------
# Repo-local Go wrapper over the C ABI. Build the release static library
# first because the cgo wrapper links the source-tree archive directly.
# ----------------------------------------------------------------------
go-wrapper:
name: go wrapper (cgo)
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable (2026-03-27)
with:
toolchain: stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
- name: cargo build -p ordvec-ffi --release
run: cargo build -p ordvec-ffi --release
- name: go test
working-directory: ordvec-go
env:
GOCACHE: ${{ runner.temp }}/go-build
run: go test -count=1 ./...
- name: go test -race
working-directory: ordvec-go
env:
GOCACHE: ${{ runner.temp }}/go-build
run: go test -race -count=1 ./...
- name: go test (cgocheck2)
working-directory: ordvec-go
env:
GOEXPERIMENT: cgocheck2
GOCACHE: ${{ runner.temp }}/go-build-cgocheck2
run: go test -count=1 ./...

# ----------------------------------------------------------------------
# Test matrix across the three GitHub-hosted OSes. Covers the default
# surface, the experimental feature, the no-default-features build, and a
Expand Down
21 changes: 21 additions & 0 deletions ordvec-go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ordvec-go

Thin cgo wrapper over the local `ordvec-ffi` C ABI.

Build the Rust library before running Go tests or linking a Go program:

```sh
cargo build -p ordvec-ffi --release
cd ordvec-go
go test ./...
go test -race ./...
GOEXPERIMENT=cgocheck2 go test ./...
```

`Index.Close` should be called explicitly. A finalizer is installed as a safety
net, but it is not a resource-management strategy.

Search with `nil` options or `nil` `SearchOptions.Candidates` performs a full
search. An empty, non-nil `Candidates` slice is treated as an explicit empty
subset and returns a typed `StatusBadArgument`, matching the C ABI v1
pointer/count contract.
4 changes: 4 additions & 0 deletions ordvec-go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module github.com/Fieldnote-Echo/ordvec/ordvec-go

go 1.22

Loading
Loading