CX · Reference guidecx-binding-go
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-binding-go

cxlib for Go

Why reach for it

The same C ABI, in the host's own idiom. cx-binding-go is cxlib as a Go module: a thin wrapper over libcx's string-in, string-out C ABI, so a Go program parses, canonicalises, hashes, converts and evaluates CX with the very engine the cx binary runs — byte-identical answers, nothing reimplemented.

Layer 1 is the contract every binding shares: sixteen canonical methods — parse, bytes, hash, equals, eval, select, modify and the node accessors — with identical semantics across hosts, so a document hashed from Go is the document hashed from anywhere else. Identity rides cx_canonical, cx_hash and cx_eq; selection, evaluation and update delegate to cx_code_eval; nothing about a document is retained inside libcx between calls. layer-1 is the table, c-abi the surface beneath it, layer-2 the host-idiomatic sugar above it that desugars to Layer 1.

We grade the binding against the front door's published ABI vectors — one case per entry point a wrapper covers, an input document and the canonical output, hash or refusal it must answer — through the binding's own test, written in Go, which loads the file from its pin and asserts every vector through its own wrapper. The same file is checked against libcx directly by the front door's C test, so the wrapper and the engine are held to one witness.

What it gives you

No CX module: a binding ships host code, not .cx files, so the table below is the generator's note. What it gives you is the Go module itself — the Layer-1 methods, and the package-level conveniences that desugar to them.

This repository ships no bundled module of its own; what it gives you is above, and its links are below.

Try it

One ABI vector, replayed by this site's cx: an XML document imported to CX through the entry point the wrapper's XmlToCx calls, and the canonical text it must answer. The binding's own test asserts the same vector through the wrapper; this page shows the engine's own answer.

        $ cx --from=xml --to=cx input.xml
[user id=1 name=Alice]
      

Fixture abi-010-xml-to-cx in deps/cx-core-code/conformance/abi.cxd — replayed against this cx when the page was built.

Status

The binding is not consumed by cx — it consumes cx: its own deps.cxd pins the front door for the C ABI and the V core it builds libcx from, which is why the registry row carries no at= and the figure draws no column on either side. It ships from its own repository at its own cadence, and a pin moves there only when the newer front door passes with it.

fact as the registry records it
ships as go-module
status extracted
pinned at 96392afa6 — the registry's at=; deps.cxd carries no row for it, so nothing of it is in the build
builds on none recorded — the registry row carries no pins= column yet
built on by nothing pins it yet
bundled modules 0
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY none recorded — no pins= on the registry row yet cx-binding-go no bundled module — see its row nothing pins it yet DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-binding-go plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built