Intro

status-go can be built in two modes:

cgo is used to in order to provide bridge between JNI and iOS. Internally we use xgo for cross building (xgo is a docker image with all necessary build dependencies, for a given build target, installed)

The main working branch for status-go is develop .

Prerequisites

Makefile

We use Makefile , you can run make help to see available commands:

Easy:
  run-bootnode-systemd            way to run a bootnode locally with Docker Compose
  run-bootnode-docker             way to run a bootnode locally with Docker Compose
  run-mailserver-systemd          Run a mailserver locally with systemd
  run-mailserver-docker           Run a mailserver locally with Docker Compose
  clean-bootnode-systemd          Clean your systemd service for running a bootnode
  clean-bootnode-docker           Clean your Docker container running a bootnode
  clean-mailserver-systemd        Clean your systemd service for running a mailserver
  clean-mailserver-docker         Clean your Docker container running a mailserver

build:
  bootnode                        Build discovery v5 bootnode using status-go deps
  node-canary                     Build P2P node canary using status-go deps
  statusgo                        Build status-go as statusd server
  spiff-workflow                  Build node for SpiffWorkflow BPMN software

cross-compile:
  statusgo-android                Build status-go for Android
  statusgo-ios                    Build status-go for iOS
  statusgo-library                Build status-go as static library for current platform
  statusgo-shared-library         Build status-go as shared library for current platform

docker:
  docker-image                    Build docker image (use DOCKER_IMAGE_NAME to set the image name)

install:
  install-os-deps                 Operating System Dependencies
  install-gomobile                Go Mobile Build Tools
  install-lint                    Install Linting Tools
  install-junit-report            Install Junit Report Tool for Jenkins integration
  install-mock                    Install Module Mocking Tools
  install-modvendor               Install Module Vendoring Tool
  install-protobuf                Install Protobuf Generation Tools
  install-release                 Install Github Release Tools
  install-xtools                  Install Miscellaneous Go Tools

other:
  help                            Show this help
  generate                        Regenerate assets and other auto-generated stuff
  mock                            Regenerate mocks
  clean                           Cleanup
  update-fleet-config             Update fleets configuration from fleets.status.im

setup:
  setup                           Install all tools
  setup-check                     Check if Go compiler is installed.
  setup-dev                       Install all necessary tools for development
  setup-build                     Install all necessary build tools

statusd-prune:
  statusd-prune                   Build statusd-prune
  statusd-prune-docker-image      Build statusd-prune docker image

tests:
  docker-test                     Run tests in a docker container with golang.
  test                            Run basic, short tests during development
  test-unit                       Run unit and integration tests
  test-unit-race                  Run unit and integration tests with -race flag
  test-e2e                        Run e2e tests
  test-e2e-race                   Run e2e tests with -race flag
  ci                              Run all linters and tests at once
  ci-race                         Run all linters and tests at once + race

Makefile commands use build/env.sh script that makes sure that everything is built within build/_workspace and we do not touch system-wise Go installation, and all vendored dependencies are pushed to build/_workspace.

You may also use go build /go test commands manually.

Unit testing individual functions

Normally, you can launch unit tests from the root directory using the make command like displayed above . However, sometimes you just want to run a test on a particular function and not the whole set of tests in a suite of a package. This can help save your time! To do so, you can run the following command by moving into the directory containing the tests.

Please replace the parameters in the sample command with the parameters that fits your testing purposes.

go test -tags gowaku_skip_migrations,gowaku_no_rln -run '^(TestMessengerSuite)$' -testify.m '^(Test)$' github.com/status-im/status-go/protocol