Differential Privacy in Go
This is the Go implementation of the differential privacy library. For general details and key definitions, see the top-level documentation. This document describes Go-specific aspects.
How to Use
Usage of the Go Differential Privacy library is demonstrated in the codelab.
Full documentation of the API is available as godoc.
Using with the "go" Command
For building the differential privacy library with the "go" command, you can run the following:
go build -mod=mod ./...
This will build all the packages.
-mod=mod is necessary for installing all the
dependencies automatically. Otherwise, you'll be asked to install each
Similarly, you can run all the tests with:
go test -mod=mod ./...
If you already built the code with
go build, you can omit
If you wish to run the codelab, you can do so by (from the root of the repository):
cd examples/go/main go run -mod=mod . -scenario=CountVisitsPerHour -input_file=../data/day_data.csv -non_private_output_file=out1.csv -private_output_file=out2.csv
input_file to run other scenarios. Check out the
for more information.
Package checks contains checks for differentially private functions.
|Package checks contains checks for differentially private functions.|
Package dpagg contains differentially private aggregation primitives.
|Package dpagg contains differentially private aggregation primitives.|
Package noise contains methods to generate and add noise to data.
|Package noise contains methods to generate and add noise to data.|
Package rand provides methods for generating random numbers from distributions useful for the differential privacy library.
|Package rand provides methods for generating random numbers from distributions useful for the differential privacy library.|