# Developers Guide

This chapter will show how to work on Gorse source code.

# Setup Develop Environment

These following installations are required:

  • Go (>= 1.18): Since Go features from 1.18 are used in Gorse, the version of the compiler must be greater than 1.18. GoLand or Visual Studio Code is highly recommended as the IDE to develop Gorse.
  • Docker Compose: Multiple databases are required for unit tests. It's convenient to manage databases on Docker Compose.
cd misc/database_test
docker-compose up -d

# Run Unit Tests

Most logics in Gorse are covered by unit tests. Run unit tests by the following command:

go test -v ./...

The default database URLs are directed to these databases in misc/database_test/docker-compose.yml. Test databases could be overrode by setting following environment variables:

Environment Value Default Value
MYSQL_URI mysql://root:password@tcp(
POSTGRES_URI postgres://gorse:gorse_pass@
MONGO_URI mongodb://root:password@
CLICKHOUSE_URI clickhouse://
REDIS_URI redis://

For example, use TiDB as a test database by:

MYSQL_URI=mysql://root:password@tcp( go test -v ./...