Developing CRC

Overview

The following sections describe how to build and test the project.

Prerequisites

  • git
  • make
  • A recent Go distribution (>=1.11)

note

You should be able to develop the project on Linux, Windows, or macOS.

Setting up the development environment

Cloning the repository

Get the sources from GitHub:

$ git clone https://github.com/crc-org/crc.git

note

Do not keep the source code in your $GOPATH, as Go modules will cause make to fail.

Dependency management

CRC uses Go modules for dependency management.

For more information, see the following:

  1. Introduction to Go modules
  2. Using Go modules

Compiling the CRC Binary

In order to compile the crc executable for your local platform, run the following command:

$ make

By default, the above command will place the crc executable in the $GOBIN path.

Run the following command to cross-compile the crc executable for many platforms:

$ make cross

Note: This command will output the cross-compiled crc executable(s) in the out directory by default:

$ tree out/
out/
├── linux-amd64
│   └── crc
├── macos-amd64
│   └── crc
└── windows-amd64
    └── crc.exe

Running unit tests

To run all unit test use:

$ make test

If you need to update mocks use:

$ make generate_mocks