↓ Ir para o conteúdo principal

google-oss

Guia de conformidade e licenciamento para repositórios Google Open Source e projetos pessoais publicados por Googlers. Aplica cabeçalhos de licença Apache-2.0 via addlicense, verifica arquivos LICENSE e insere avisos obrigatórios de pré-lançamento.

Nota: As instruções originais do SKILL.md abaixo são mantidas em inglês para máxima precisão de execução pelos modelos.

Google open-source compliance and licensing #

Audit, apply, and verify Google Open Source policy requirements, source code license headers with addlicense, and mandatory repository disclaimers.

Available scripts #

  • scripts/apply-license.sh: Cross-platform helper that resolves addlicense from $PATH, $GOBIN, or $GOPATH/bin (installing it automatically when missing), ignores generated and vendored directories safely (vendor/, node_modules/, .venv/, third_party/, _site/, *.pb.go), and supports both apply and read-only --check modes.
bash
# Inspect options and usage
bash scripts/apply-license.sh --help

# Apply headers to a corporate Google Open Source repo
bash scripts/apply-license.sh -c "Google LLC" .

# Apply headers to a personal open-source repo
bash scripts/apply-license.sh -c "Jane Doe" -l apache src/

# Verify header coverage in CI without modifying files
bash scripts/apply-license.sh --check -c "Google LLC" .

Flags:

  • -h, --help: Show usage and exit cleanly.
  • --check: Audit existing headers and exit non-zero if any matching file lacks one.
  • -c, --holder: Copyright holder string (defaults to Google LLC).
  • -l, --license: License type: apache (default), bsd, mit, or mpl.
  • -y, --year: Copyright year passed to addlicense -y.
  • -s, --spdx-only: Emit SPDX short-form identifiers only.
  • -i, --ignore: Add extra ignore globs (repeatable).
  • --no-default-ignores: Skip built-in build and vendor ignore patterns.
❗ IMPORTANT

Always inspect the root LICENSE file and existing source headers before applying or checking copyright banners:

  • Corporate Google Open Source repositories (github.com/google/*, googleapis/*, GoogleCloudPlatform/*, or Google-owned projects): use -c "Google LLC".
  • IARC-approved personal projects owned by a Googler: use -c "<Author Name>" so you never overwrite personal copyright with "Google LLC", while still adding the required non-official Google product disclaimer to README.md.

Applying and checking headers directly with addlicense #

Install addlicense via Go when calling the binary directly:

bash
go install github.com/google/addlicense@latest

Resolve addlicense across $PATH, GOBIN, and GOPATH:

bash
ADDLICENSE="${GOBIN:-$(go env GOBIN)}"
ADDLICENSE="${ADDLICENSE:+${ADDLICENSE}/addlicense}"
ADDLICENSE="${ADDLICENSE:-$(go env GOPATH)/bin/addlicense}"
command -v addlicense >/dev/null 2>&1 && ADDLICENSE="addlicense"

# Apply Apache-2.0 headers while skipping third-party trees
"$ADDLICENSE" -c "Google LLC" -l apache \
  -ignore "vendor/**" -ignore "node_modules/**" -ignore ".venv/**" .

# Audit without editing files (CI check)
"$ADDLICENSE" -check -c "Google LLC" -l apache \
  -ignore "vendor/**" -ignore "node_modules/**" -ignore ".venv/**" .

Common addlicense flags:

  • -l apache: Apache License 2.0 (standard default).
  • -l mit or -l bsd: MIT or BSD 3-Clause header format.
  • -s=only: Short SPDX identifier only (// SPDX-License-Identifier: Apache-2.0).
  • -ignore "vendor/**": Exclude third-party or generated files such as *.pb.go.

Required README disclaimers #

Every repository published by Googlers or under Google Open Source that is not an official Google product needs the matching disclaimer at the bottom of README.md.

Standard non-official product disclaimer #

markdown
---

## Disclaimer

This is not an officially supported Google product.

Experimental or educational project disclaimer #

markdown
---

## Disclaimer

This is not an officially supported Google product. It is an experimental project created for educational and development purposes.

Pre-release compliance checklist #

  1. License header coverage: Run scripts/apply-license.sh --check (or addlicense -check) across .go, .py, .ts, .js, .rs, .c, .cpp, .sh, and .proto files, confirming generated and third-party files stay excluded.
  2. Root LICENSE file: Confirm an unmodified text copy of the chosen license exists at the repository root.
  3. Copyright holder accuracy: Verify the header holder matches corporate (Google LLC) or personal ownership rules.
  4. Non-official product disclaimer: Confirm the ## Disclaimer section appears at the bottom of README.md.
  5. Zero internal leaks: Verify there are no internal URLs, internal bug trackers, corporate credentials, or non-public codenames.

References #