Skip to content

Prerequisites

Golang 1.24.3

Mac:

brew install go@1.24.3

Ubuntu:

apt-get update
wget https://go.dev/dl/go1.24.3.linux-amd64.tar.gz
tar xvf ./go1.24.3.linux-amd64.tar.gz
rm ./go1.24.3.linux-amd64.tar.gz
mv ./go/ /usr/local/

Add the following lines in ~/.profile:

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Test the version:

go version

Docker client

Mac:

brew install docker

To enable network connectivity to Docker containers from macOS, run the following commands:

brew install chipmk/tap/docker-mac-net-connect
sudo brew services start chipmk/tap/docker-mac-net-connect

If you’re still experiencing issues, try restarting the service with the following command:

sudo brew services restart chipmk/tap/docker-mac-net-connect

Ubuntu:

Follow instructions here

To grant access to a non-root user:

apt install acl
setfacl --modify user:cbdcdemo:rw /var/run/docker.sock

Quickstart

Build

You can build locally or via a docker.

Local build:

make build

Docker build:

make build-docker

Build linux binaries for remote machines:

make build os=linux arch=amd64 output_dir=./bin-linux

Test

To execute the tests, use:

make test

Race Detection

The project uses Go's race detector to catch data race conditions during test execution. Race detection is:

  • Enabled by default in CI and local development for unit tests (test-no-db, test-all-db)
  • Not enabled for integration and container tests to avoid excessive slowdown

Golang Development Dependencies Installation

scripts/install-dev-dependencies.sh

Note on Database Requirements

In some tests, a DB is required (YugabyteDB or PostgreSQL 18+). The test harness will either create a YugabyteDB Docker instance or reuse an existing instance. Therefore, the test harness will not shut down the DB container between tests. Once you no longer intend to run tests, you can stop the container using make kill-test-docker.

It is possible to use your own YugabyteDB instance by setting the following environment variable: DB_DEPLOYMENT=local. This will instruct the test harness to connect to your local DB instance at port 5433, rather than creating any Docker instance. YugabyteDB's quick start guide offers more information on how to install and run the database locally.

PostgreSQL Support: The project supports PostgreSQL 18 or later. Docker images use postgres:18.3-alpine3.23.

Example: Start Yugabyte via docker

docker run --name sc_yugabyte_unit_tests \
  --platform linux/amd64 \
  -p 5433:5433 \
  -d yugabytedb/yugabyte:2025.2.0.1-b1 \
  bin/yugabyted start \
  --background=false \
  --advertise_address=0.0.0.0 \
  --callhome=false \
  --fault_tolerance=none \
  --ui=false \
  --tserver_flags=ysql_max_connections=5000 \
  --insecure