Development Guides

pREST is written in the go language and we use the best practices recommended by the language itself to simplify its contribution. If you are not familiar with the language, read the Effective Go.

Development usage

As mentioned before prest is written in go, as it is in the document topic of using prest in development mode it is important to know the go language path structure, if you don’t know it read the page How to Write Go Code (with GOPATH).

Assuming you do not have the repository cloned locally, we are assuming you are reading this page for the first time_

Download all of pREST’s dependencies

git clone && cd prest
go mod download

We recommend using go run for development environment, remember that it is necessary environment variables for pREST to connect to PostgreSQL - we will explain in the next steps how to do it

go run cmd/prestd/main.go

Building a local version (we will not use flags for production environment)

go build -o prestd cmd/prestd/main.go

Executing the prestd after generating binary or using go run


to use go run replace ./prestd with go run

or use 'prest.toml' file as a preset configuration, insert a user to see the changes

Execute unit tests locally (integration/e2e)

pREST’s unit tests depend on a working Postgres database for SQL query execution, to simplify the preparation of the local environment we use docker (and docker-compose) to upload the environment with Postgres.

all tests:

docker-compose -f testdata/docker-compose.yml up --abort-on-container-exit

package-specific testing: in the example below the config package will be tested

docker-compose -f testdata/docker-compose.yml run --rm prest-test sh ./testdata/ ./config

specific function test: in the example below will run the test TestGetDefaultPrestConf from the config package, don’t forget to call the TestMain function before your function

docker-compose -f testdata/docker-compose.yml run prest-test sh ./testdata/ ./config -run TestMain,TestGetDefaultPrestConf