cannectors

Cross-platform builds

Building Cannectors for Linux, macOS, and Windows from one host.

Cannectors is a pure-Go binary — no cgo, no SQLite dynamic links, no locale tables baked in. That means you can build for any Go-supported OS/arch from any other host with a single go build invocation, or the Makefile targets that wrap it.

Makefile targets

make build               # current host
make build-linux         # → bin/cannectors-linux-amd64
make build-darwin        # → bin/cannectors-darwin-arm64
make build-windows       # → bin/cannectors-windows-amd64.exe
make build-all           # all three

All four produce stripped, statically-linked binaries suitable for dropping into a container image or copying to a fresh host.

Going manual

If you want a target outside the Makefile (e.g. linux/arm64 for a Raspberry Pi or AWS Graviton):

GOOS=linux GOARCH=arm64 \
  go build -trimpath -ldflags="-s -w" \
  -o bin/cannectors-linux-arm64 \
  ./cmd/cannectors

-trimpath strips local filesystem paths from the binary, -s -w strip the symbol table and DWARF info. Together they cut the binary size roughly in half.

Supported targets

The toolchain supports anything Go does — see go tool dist list. Tested in CI:

OSArchNotes
linuxamd64Primary platform for production.
linuxarm64Graviton, Raspberry Pi 4+, Apple-on-Linux CI.
darwinamd64Intel Mac dev machines.
darwinarm64Apple Silicon dev machines.
windowsamd64Tested manually.

The binary doesn't depend on:

  • libc (CGO_ENABLED=0 by default)
  • the system OpenSSL (Go ships its own TLS stack)
  • the system timezone data (time.LoadLocation bundles tzdata)
  • a SQLite shared library (modernc.org/sqlite is pure Go)

You can copy bin/cannectors-linux-amd64 into a scratch container image and it will run. No apt install step.

Container images

A minimal Dockerfile:

FROM scratch
COPY bin/cannectors-linux-amd64 /usr/local/bin/cannectors
ENTRYPOINT ["/usr/local/bin/cannectors"]
CMD ["version"]

For TLS connections (any HTTP-shaped input/output/filter), you'll need CA certificates:

FROM alpine:3.20 AS certs
RUN apk add --no-cache ca-certificates

FROM scratch
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY bin/cannectors-linux-amd64 /usr/local/bin/cannectors
ENTRYPOINT ["/usr/local/bin/cannectors"]

Built image size: ~15 MB.

See also