Please make sure to read and observe our Code of Conduct.
- We follow Go Code Review
- At a minimum, use
go fmtto format your code before committing. Ideally you should usetrunkas our CI will runtrunkon your code - If you see any code which clearly violates the style guide, please fix it and send a pull request. No need to ask for permission
- Avoid unnecessary vertical spaces. Use your judgment or follow the code review comments
- Wrap your code and comments to 120 characters, unless doing so makes the code less legible
Every new source file must begin with a license header.
Most of Dgraph, Badger, and the Dgraph clients (dgo, dgraph-js, pydgraph and dgraph4j) are licensed under the Apache 2.0 license:
/*
* SPDX-FileCopyrightText: © 2017-2026 Istari Digital, Inc.
* SPDX-License-Identifier: Apache-2.0
*/You can start by finding an existing issue with the good first issue or help wanted labels. These issues are well suited for new contributors.
- Install Go 1.25.0 or above.
- Install trunk. Our CI uses trunk to lint and check code, having it installed locally will save you time.
- Visit https://github.com/dgraph-io/badger
- Click the
Forkbutton (top right) to create a fork of the repository
git clone https://github.com/$GITHUB_USER/badger
cd badger
git remote add upstream git@github.com:dgraph-io/badger.git
# Never push to the upstream main
git remote set-url --push upstream no_pushGet your local main up to date:
git fetch upstream
git checkout main
git rebase upstream/mainCreate a new branch from the main:
git checkout -b my_new_featureAnd now you can finally add your changes to project.
Build and run all tests:
./test.shCommit your changes:
git commitWhen the changes are ready to review:
git push origin my_new_featureJust open https://github.com/$GITHUB_USER/badger/pull/new/my_new_feature and fill the PR
description.
Click the Sign in with Github to agree button to sign the CLA. An example.
If your pull request (PR) is opened, it will be assigned to one or more reviewers. Those reviewers will do a code review.
To address review comments, you should commit the changes to the same branch of the PR on your fork.