Skip to content

Commit 6909a8c

Browse files
fix(go): limit native bindings to supported targets
1 parent e127a6d commit 6909a8c

8 files changed

Lines changed: 16 additions & 24 deletions

File tree

sdks/go/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ For external projects, the explicit `--vendor` option lets the installer vendor
1919
the bindings before placing the library next to them, so the normal `go build`
2020
command finds it.
2121

22+
Native bindings currently support Linux (`amd64`, `arm64`) and Apple Silicon
23+
macOS (`arm64`). Other platforms, including Windows, use the
24+
bindings-unavailable stub until a compatible native release is available.
25+
2226
From a checkout of the bindings package, you can instead use:
2327

2428
```bash

sdks/go/bindings/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ vendor` includes the bindings package.
3030
Requirements:
3131

3232
- `CGO_ENABLED=1` (default on Linux and macOS)
33-
- A C compiler (`gcc` on Linux, Xcode CLI tools on macOS, MinGW on Windows)
33+
- A C compiler (`gcc` on Linux, Xcode CLI tools on macOS)
34+
- One of the supported native targets: Linux (`amd64`, `arm64`) or Apple Silicon
35+
macOS (`arm64`)
36+
37+
Windows currently uses the bindings-unavailable stub. Native Windows support
38+
will require a MinGW-compatible C SDK release artifact.
3439

3540
## Layout
3641

@@ -44,7 +49,6 @@ bindings/
4449
linux-amd64/ # libmoss.a (gitignored, downloaded at build time)
4550
linux-arm64/
4651
darwin-arm64/
47-
windows-amd64/
4852
```
4953

5054
Native `.a` / `.lib` files are gitignored. The

sdks/go/bindings/lib/windows-amd64/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

sdks/go/bindings/libmoss.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build cgo && ((linux && (amd64 || arm64)) || (darwin && arm64) || (windows && amd64))
1+
//go:build cgo && ((linux && (amd64 || arm64)) || (darwin && arm64))
22

33
package mosscore
44

sdks/go/bindings/prebuilt_windows_amd64.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

sdks/go/bindings/stub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !cgo || !((linux && (amd64 || arm64)) || (darwin && arm64) || (windows && amd64))
1+
//go:build !cgo || !((linux && (amd64 || arm64)) || (darwin && arm64))
22

33
package mosscore
44

sdks/go/sdk/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ The Go SDK now has two layers:
2020
## Current limitations
2121

2222
- CGO and a C compiler are required for full SDK functionality (`CGO_ENABLED=1`)
23+
- Native bindings support Linux (`amd64`, `arm64`) and Apple Silicon macOS
24+
(`arm64`); unsupported platforms use the bindings-unavailable stub
2325
- cloud query fallback supports `TopK` and caller-provided embeddings; `Alpha` and `Filter` require a locally loaded index
2426
- `LoadIndexOptions.CachePath` is not exposed by the current `libmoss` C API yet
2527

@@ -31,7 +33,8 @@ go run github.com/usemoss/moss/sdks/go/tools/install@latest --vendor
3133
```
3234

3335
The install tool downloads the static `libmoss` library for your platform. See
34-
[`../bindings/README.md`](../bindings/README.md) for Windows toolchain notes.
36+
[`../bindings/README.md`](../bindings/README.md) for supported platforms and
37+
toolchain notes.
3538
The explicit `--vendor` option vendors the SDK so CGO can link the downloaded
3639
library from a writable directory; commit `vendor/` if your project commits
3740
vendored dependencies. Run it after your application imports the SDK so the

sdks/go/tools/install/main.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ var platforms = []platform{
4747
id: "darwin-arm64", triple: "aarch64-apple-darwin",
4848
libFile: "libmoss.a", srcLib: "lib/libmoss.a",
4949
},
50-
{
51-
id: "windows-amd64", triple: "x86_64-pc-windows-msvc",
52-
libFile: "moss.lib", srcLib: "lib/moss.lib",
53-
},
5450
}
5551

5652
func main() {
@@ -238,8 +234,6 @@ func currentPlatformID() (string, error) {
238234
return "linux-arm64", nil
239235
case "darwin/arm64":
240236
return "darwin-arm64", nil
241-
case "windows/amd64":
242-
return "windows-amd64", nil
243237
default:
244238
return "", fmt.Errorf("unsupported platform %s/%s", runtime.GOOS, runtime.GOARCH)
245239
}

0 commit comments

Comments
 (0)