This repository contains Go code samples for Google Workspace APIs. IMPORTANT: This is a collection of independent samples, NOT a monolithic application. Each directory typically contains a standalone executable or package.
The repository is organized by API service:
[api]/[sample-type]/(e.g.,drive/quickstart/,sheets/snippets/)
To build all samples:
go build -v ./...Note: If builds are cached and silent, use go build -v -a ./... to force output.
Ensure all code is formatted with standard gofmt.
# Check for unformatted files (exit code 1 if output is not empty)
test -z $(gofmt -l .)
# Fix formatting
go fmt ./...Run static analysis:
go vet ./...Run unit tests (where available):
go test -v ./...Ensure modules are clean:
go mod tidy- Go Version: Latest Stable (currently 1.24+)
- CI Pipelines:
Test: Runs build checks viago build.Lint: Runsgofmtandgo vet.
When writing samples that will be referenced in documentation, mark the regions using the following format:
// [START unique_snippet_id]
func Example() {
// ...
}
// [END unique_snippet_id]- Ensure the ID is unique across the repository.
- Do not indent the
// [START ...]and// [END ...]tags.