This section is intended to help developers and contributors get a working copy of
go-client on their end
1. Clone this repository
git clone https://github.com/ripple.mq/go-client
cd go-clientThis section will guide you to setup a fully-functional local copy of go-client
on your end and teach you how to use it! Make sure you have installed
golangci-lint before following this section!
Note: This section relies on the usage of Makefile. If you
can't (or don't) use Makefile, you can follow along by running the internal commands
from go-client's Makefile (most of which are
OS-independent)!
To install all dependencies associated with go-client, run the
command
make installCode formatters format your code to match pre-decided conventions. To run automated code formatters, use the Makefile command
make codestyleLinters are tools that analyze source code for possible errors. This includes typos, code formatting, syntax errors, calls to deprecated functions, potential security vulnerabilities, and more!
To run pre-configured linters, use the command
make lintTests in go-client are classified as fast and slow - depending
on how quick they are to execute.
To selectively run tests from either test group, use the Makefile command
make fast-test
OR
make slow-testAlternatively, to run the complete test-suite -- i.e. fast and slow tests at one go, use the command
make testThe test-suite is simply a wrapper to run linters, stylecheckers and all tests
at once!
To run the test-suite, use the command
make test-suiteIn simpler terms, running the test-suite is a combination of running linters
and all tests one after the other!
Tap for a list of Makefile commands
| Command | Description | Prerequisites |
|---|---|---|
help |
Generate help dialog listing all Makefile commands with description | NA |
install |
Fetch project dependencies | NA |
codestyle |
Run code-formatters | golangci-lint |
lint |
Check codestyle and run linters | golangci-lint |
test |
Run all tests | NA |
fast-tests |
Selectively run fast tests | NA |
slow-tests |
Selectively run slow tests | NA |
test-suite |
Check codestyle, run linters and all tests | golangci-lint |
run |
Run go-client | NA |
docker-gen |
Create production docker image for go-client | docker |
docker-debug |
Create debug-friendly docker image for go-client | docker |
clean-docker |
Remove docker image generated by docker-gen |
docker |
Optionally, to see a list of all Makefile commands, and a short description of what they do, you can simply run
makeWhich is equivalent to;
make helpBoth of which will list out all Makefile commands available, and a short description of what they do!
To generate binaries for multiple OS/architectures, simply run
bash build-script.shThe command will generate binaries for Linux, Windows and Mac targetting multiple
architectures at once! The binaries, once generated will be stored in the bin
directory inside the project directory.
The binaries generated will be named in the format
go-client_<version>_<target-os>_<architecture>.<extension>
The <extension> is optional. By default, version is an empty string. A custom
version can be passed as an argument while running the script. As an example;
bash build-script.sh v1.2.1An example of the files generated by the previous command will be;
go-client_v1.2.1_windows_x86_64.exeTo run go-client in a docker container, read the instructions in
docker section.
To run go-client, use the command
make runAdditionally, you can pass any additional command-line arguments (if needed) as the
argument "q". For example;
make run q="--help"
OR
make run q="--version"