This guide explains how to set up your environment for developing on Datree.
This guide was written for macOS and Linux machines.
- Go version 1.19
- Git
We use Make to build our programs. The simplest way to get started is:
$ make build
This will build the executable file and place it in the project root.
One way to run datree locally is to use the newly created executable file:
$ ./datree test ./internal/fixtures/kube/k8s-demo.yaml
To run all the tests:
$ make test
Make sure you have read and understood the main CONTRIBUTING guide:
We use cobra as our Command Line Interface framework.
The available commands can be found under the cmd
directory; each folder represents a datree command. To add a
command, add a folder with the cobra command, and use it in the cmd/root.go
file.
Datree requires an internet connection to connect to our backend API.
While developing locally, API requests will reach our staging environment and be visible on
the Staging Dashboard.
All available API requests can be found under pkg/cliClient
It's best to use fixtures for manual testing, which are found under internal/fixtures
To add a test for a given file, add a file with a _test
suffix.
For example: for the file ./reader.go
add a test file ./reader_test.go
- For bug fixes: add a test that covers the bug fixed
- For features: add tests for the feature
The main branch is the home of the current development candidate.
We accept changes to the code via GitHub Pull Requests (PRs). One workflow for doing this is as follows:
- Fork the repository and clone it locally.
- Create a new working branch
git checkout -b "ISSUE#195_some_short_description"
- When you are ready for us to review your changes, push your branch to GitHub, and then open a new pull request to
the
main
branch.
For Git commit messages, please follow
our Commit Message Format.
For example: git commit -m "feat: add windows support"
We follow the standard go formatting - simply use your IDE's auto-formatter to make your code beautiful.