Artifact 6793da6cca9115e527e9d065b47e92ada09fc1ef4170e6543f01b52e25b42e20:
- File
hub/driver.go
— part of check-in
[0fa13d595b]
at
2026-05-13 21:03:54
on branch trunk
— fix: exclude modernc driver registration from wasm builds (#169)
The init()-based modernc registration added in #166 (v0.0.18) blocked wasm builds because modernc references syscalls unavailable under js/wasm. Adds a //go:build !js && !wasm constraint to hub/driver.go so the registration is skipped on wasm targets — wasm consumers register their own driver (libfossil's ncruces driver supports wasm via its ncruces_js.go file).
Native builds are unchanged: hub still auto-registers modernc. Wasm builds: hub package now compiles successfully under GOOS=js GOARCH=wasm; consumer brings its own driver.
Verified: GOOS=js GOARCH=wasm go vet ./hub/... # clean GOOS=js GOARCH=wasm go build ./hub/... # success go test ./hub/... -timeout 120s # 38/38 pass on native
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (user: [email protected], size: 845) [annotate] [blame] [check-ins using]
//go:build !js && !wasm package hub // libfossil's db layer requires a SQL driver to be registered before any // Repo can be opened. Registering it here means consumers of EdgeSync can // `import "github.com/danmestas/EdgeSync/hub"` without also taking a direct // dependency on libfossil's internal SQL machinery — the package doc // promise that consumers don't need to import libfossil holds end-to-end. // // modernc is a pure-Go cgo-free SQLite driver suitable for every supported // GOOS/GOARCH except js/wasm — its generated code references unsupported // syscalls under those targets. The build constraint above excludes this // file from wasm compilation; wasm consumers must register their own // driver (libfossil's ncruces driver has wasm support via ncruces_js.go). import _ "github.com/danmestas/libfossil/db/driver/modernc"