The following document outlines how to contribute to the tb
project.
To build and run tb
locally you will need to install go.
This can likely be done through your package manager or by going to https://golang.org/doc/install.
For example, on macOS you can use homebrew by running:
brew install go
First clone the repo to your desired location:
git clone [email protected]:TouchBistro/tb.git
Then in the root of the repo run the following to install all dependencies and tools required:
make setup
To build the app run:
go build
This will create a binary named tb
in the current directory. You can run it be doing ./tb
.
If you want to be able to run if from anywhere you can run:
go install
This will installing it in the bin
directory in your go path.
NOTE: You will need to add the go bin to your PATH
variable.
Add the following to your .zshrc
or .bash_profile
:
export PATH="$(go env GOPATH)/bin:$PATH"
Then run source ~/.zshrc
or source ~/.bash_profile
.
The global build will likely take precedence over the version installed with brew. This is fine during development but might be annoying otherwise.
To remove the globally installed build run the following from the root directory of the repo:
make go-uninstall
To run the linter run:
make lint
To run the tests run:
make test
This will output code coverage information to the coverage
directory.
You can open the coverage/coverage.html
file in your browser to visually see the coverage in each file.
To remove the build and another other generated files run:
make clean
Additionally if go.sum
gets modified on build, please run go mod tidy
to clean it up before committing and pushing changes.