Contributions to this project are welcomed. We request that you read through the guidelines before getting started.
Contributions to this project must be accompanied by a Contributor License Agreement (CLA). You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project. Head over to https://cla.developers.google.com/ to see your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
This project follows Google's Open Source Community Guidelines.
All submissions will be reviewed before merging. Submissions are reviewed using GitHub pull requests.
Common code is in the /pkg
folder.
Each binary will have its main.go
file in a /cmd/[bin-name]
folder.
To run the server, you must install the following dependencies:
Run the tests with:
$ go test ./...
To run tests that interact with the database:
-
Set up the environment:
$ eval $(./scripts/dev init)
-
Start a local database instance:
$ ./scripts/dev dbstart
-
Run the tests:
$ go test -v ./...
You should run the presubmit checks before committing changes. The presubmit script
is located at scripts/presubmit.sh
.
You can add a prepush hook by linking to the presubmit script to automatically run before pushing a branch to the remote GitHub repository. To add the presubmit script as a prepush hook, go to the root directory of the repository and type:
ln -s -f ../../scripts/presubmit.sh .git/hooks/pre-push
chmod a+x .git/hooks/pre-push
These instructions use Docker to run components locally. You may be
able to run these components without Docker, but these instructions assume
Docker is installed and available in your $PATH
.
-
Set development environment variables:
$ eval $(./scripts/dev init)
If you close your terminal tab or session, you will need to re-run this command.
-
Create the local development database:
$ ./scripts/dev dbstart
This command may take a few minutes to execute on the first invocation. This is because it needs to download the Postgres container. Future invocations will be faster.
-
Run any migrations. This creates the tables and schema:
$ ./scripts/dev dbmigrate
-
(Optional) Seed the database with some initial data:
$ ./scripts/dev dbseed
-
Run a component. For example, to run the
exposure
endpoint:$ go run ./cmd/exposure/...
Alternatively, you can run all the server components as a single binary with each component at a different path:
$ go run ./cmd/monolith/...
-
When you're done developing, you can stop the database.
$ ./scripts/dev dbstop
Warning: This will also delete any stored data in the database.
User documentation for this project is in the docs
directory,
with information on building, deploying, and using the reference implementation.