go get golang.org/x/review/git-codereviewto install the code reviewing tool.
GOBINdirectory (by default
$GOPATH/bin) is in your
PATHso that git can find the command.
git codereview changebecomes
git change. See the godoc for details.
go get -d cloud.google.com/go.
If you have already checked out the source, make sure that the remote git origin is https://code.googlesource.com/gocloud:
git remote set-url origin https://code.googlesource.com/gocloud
git codereview change <name>, provide a commit message, and use
git codereview mailto create a Gerrit CL.
git codereview changeand mail as your receive feedback. Each new mailed amendment will create a new patch set for your change in Gerrit.
In addition to the unit tests, you may run the integration test suite.
To run the integrations tests, creating and configuration of a project in the Google Developers Console is required.
After creating a project, you must create a service account. Ensure the project-level Owner IAM role role is added to the service account. Alternatively, the account can be granted all of the following roles:
Once you create a project, set the following environment variables to be able to run the against the actual APIs.
Some packages require additional environment variables to be set:
Some packages can record the RPCs during integration tests to a file for subsequent replay. To record, pass the
-record flag to
go test. The recording will be saved to the package
.replay file. To replay integration tests from a saved recording, the replay file must be present, the
-short flag must be passed to
go test, and the GCLOUD_TESTS_GOLANG_ENABLE_REPLAY environment variable must have a non-empty value.
Install the gcloud command-line tool to your machine and use it to create some resources used in integration tests.
From the project's root directory:
# Set the default project in your env. $ gcloud config set project $GCLOUD_TESTS_GOLANG_PROJECT_ID # Authenticate the gcloud tool with your account. $ gcloud auth login # Create the indexes used in the datastore integration tests. $ gcloud preview datastore create-indexes datastore/testdata/index.yaml # Create a Google Cloud storage bucket with the same name as your test project, # and with the Stackdriver Logging service account as owner, for the sink # integration tests in logging. $ gsutil mb gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID $ gsutil acl ch -g firstname.lastname@example.org:O gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID # Create a PubSub topic for integration tests of storage notifications. $ gcloud beta pubsub topics create go-storage-notification-test # Create a Spanner instance for the spanner integration tests. $ gcloud beta spanner instances create go-integration-test --config regional-us-central1 --nodes 1 --description 'Instance for go client test' # NOTE: Spanner instances are priced by the node-hour, so you may want to delete # the instance after testing with 'gcloud beta spanner instances delete'. # For Storage integration tests: # Enable KMS for your project in the Cloud Console. # Create a KMS keyring, in the same location as the default location for your project's buckets. $ gcloud kms keyrings create MY_KEYRING --location MY_LOCATION # Create two keys in the keyring, named key1 and key2. $ gcloud kms keys create key1 --keyring MY_KEYRING --location MY_LOCATION --purpose encryption $ gcloud kms keys create key2 --keyring MY_KEYRING --location MY_LOCATION --purpose encryption # As mentioned above, set the GCLOUD_TESTS_GOLANG_KEYRING environment variable. $ export GCLOUD_TESTS_GOLANG_KEYRING=projects/$GCLOUD_TESTS_GOLANG_PROJECT_ID/locations/MY_LOCATION/keyRings/MY_KEYRING # Authorize Google Cloud Storage to encrypt and decrypt using key1. gsutil kms authorize -p $GCLOUD_TESTS_GOLANG_PROJECT_ID -k $GCLOUD_TESTS_GOLANG_KEYRING/cryptoKeys/key1
Once you've done the necessary setup, you can run the integration tests by running:
$ go test -v cloud.google.com/go/...
Before we can accept your pull requests you'll need to sign a Contributor License Agreement (CLA):
You can sign these electronically (just scroll to the bottom). After that, we'll be able to accept your pull requests.
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.