Google Open Source Compliance & License Attributions #
Audit, apply, and verify Google Open Source policy requirements, source code license headers (addlicense), and mandatory repository disclaimers.
โก Quick Reference: Actions & Commands #
1. Apply License Headers via addlicense #
Install the official Google addlicense tool if not already present:
go install github.com/google/addlicense@latest
Apply Apache-2.0 copyright headers across all source files:
$(go env GOPATH)/bin/addlicense -c "Google LLC" -l apache .
Verify/Check without modifying (CI gate):
$(go env GOPATH)/bin/addlicense -check -c "Google LLC" -l apache .
Common license flag options:
-l apache: Apache License 2.0 (standard default for Google OSS)-l mit: MIT License-l bsd: BSD 3-Clause License-s=only: Force SPDX short identifier style (// SPDX-License-Identifier: Apache-2.0)-ignore "vendor/**": Ignore specific directory globs
2. Mandatory README Disclaimers #
Every repository published by Googlers or under Google open source that is not an official Google product MUST include the appropriate disclaimer in the root README.md.
Standard Non-Official Product Disclaimer: #
---
## Disclaimer
This is not an officially supported Google product.
Experimental / Educational Project Disclaimer: #
---
## Disclaimer
This is not an officially supported Google product. It is an experimental project created for educational and development purposes.
๐ Pre-Release Compliance Checklist #
Before publishing or tagging any public open-source repository, verify:
- License Header Coverage:
- Run
addlicense -checkacross all code files (.go,.py,.ts,.js,.rs,.c,.cpp,.sh,.proto). - Ensure generated files (e.g.
*.pb.go) or third-party code invendor/orthird_party/are properly ignored or attributed.
- Run
- Root
LICENSEFile:- Ensure an unmodified copy of the chosen license (e.g. Apache 2.0) exists at the repository root.
- Non-Official Product Disclaimer:
- Present at the bottom of root
README.md.
- Present at the bottom of root
- Zero Internal Contamination:
- No internal links, internal issue trackers, intranet shortcuts, corporate credentials, or non-public project codenames.
๐ References & Scripts #
- License Header Variations: Full syntax for Apache 2.0, MIT, and BSD across languages.
- Disclaimer Variations: Specific disclaimer templates for samples, tools, and demos.
- Automated Helper Script: Bundled shell script to install
addlicenseand apply headers.