From 1fd5c2406ff1fffadca0cb84d8ae07e5fabcccf0 Mon Sep 17 00:00:00 2001 From: Preetam Dwivedi Date: Thu, 5 Mar 2026 21:03:08 -0800 Subject: [PATCH] feat(lint/license): Add Apache 2.0 license headers to all source files Add a license header linter tool (tool/linter/licenseheader) with --check and --fix modes, and apply headers to all 128 .go and .proto files. --- Makefile | 10 +- core/consumer/consumer.go | 14 ++ core/consumer/consumer_test.go | 14 ++ core/consumer/controller.go | 14 ++ core/consumer/registry.go | 14 ++ core/consumer/registry_test.go | 14 ++ core/errs/errs.go | 14 ++ core/errs/errs_test.go | 14 ++ core/metrics/metrics.go | 14 ++ core/metrics/metrics_test.go | 14 ++ core/request/request.go | 14 ++ core/request/request_test.go | 14 ++ entity/batch.go | 14 ++ entity/batch_dependent.go | 14 ++ entity/batch_test.go | 14 ++ entity/build.go | 14 ++ entity/build_test.go | 14 ++ entity/change_provider.go | 14 ++ entity/github/change_id.go | 14 ++ entity/github/change_id_test.go | 14 ++ entity/queue/message.go | 14 ++ entity/queue/message_test.go | 14 ++ entity/queue_config.go | 14 ++ entity/request.go | 14 ++ entity/request_log.go | 14 ++ entity/request_log_test.go | 14 ++ entity/request_test.go | 14 ++ entity/speculation_tree.go | 14 ++ example/client/gateway/main.go | 14 ++ example/client/orchestrator/main.go | 14 ++ example/server/gateway/main.go | 14 ++ example/server/orchestrator/main.go | 14 ++ extension/changeprovider/change_provider.go | 14 ++ extension/counter/counter.go | 14 ++ extension/counter/mysql/counter.go | 14 ++ extension/mergechecker/github/checker.go | 14 ++ extension/mergechecker/github/checker_test.go | 14 ++ extension/mergechecker/github/graphql.go | 14 ++ extension/mergechecker/github/graphql_test.go | 14 ++ extension/mergechecker/github/validate.go | 14 ++ .../mergechecker/github/validate_test.go | 14 ++ extension/mergechecker/mergechecker.go | 14 ++ extension/mergechecker/multi.go | 14 ++ extension/mergechecker/multi_test.go | 14 ++ extension/queue/delivery.go | 14 ++ extension/queue/mysql/constants.go | 14 ++ extension/queue/mysql/ctl/commands.go | 14 ++ extension/queue/mysql/ctl/lib/admin.go | 14 ++ extension/queue/mysql/ctl/lib/admin_test.go | 14 ++ extension/queue/mysql/ctl/lib/format.go | 14 ++ extension/queue/mysql/ctl/main.go | 14 ++ extension/queue/mysql/errors.go | 14 ++ extension/queue/mysql/message_store.go | 14 ++ extension/queue/mysql/message_store_test.go | 14 ++ extension/queue/mysql/offset_store.go | 14 ++ extension/queue/mysql/offset_store_test.go | 14 ++ .../queue/mysql/partition_lease_store.go | 14 ++ .../queue/mysql/partition_lease_store_test.go | 14 ++ extension/queue/mysql/publisher.go | 14 ++ extension/queue/mysql/publisher_test.go | 14 ++ extension/queue/mysql/sql.go | 14 ++ extension/queue/mysql/sql_test.go | 14 ++ extension/queue/mysql/stores.go | 14 ++ extension/queue/mysql/subscriber.go | 14 ++ extension/queue/mysql/subscriber_test.go | 14 ++ extension/queue/publisher.go | 14 ++ extension/queue/queue.go | 14 ++ extension/queue/subscriber.go | 14 ++ extension/queue/subscription_config.go | 14 ++ extension/queue/subscription_config_test.go | 14 ++ extension/queueconfig/queueconfig.go | 14 ++ extension/scorer/composite/scorer.go | 14 ++ extension/scorer/composite/scorer_test.go | 14 ++ extension/scorer/heuristic/scorer.go | 14 ++ extension/scorer/heuristic/scorer_test.go | 14 ++ extension/scorer/scorer.go | 14 ++ extension/storage/batch_dependent_store.go | 14 ++ extension/storage/batch_store.go | 14 ++ extension/storage/build_store.go | 14 ++ extension/storage/change_provider_store.go | 14 ++ .../storage/mysql/batch_dependent_store.go | 14 ++ extension/storage/mysql/batch_store.go | 14 ++ extension/storage/mysql/build_store.go | 14 ++ .../storage/mysql/change_provider_store.go | 14 ++ extension/storage/mysql/request_log_store.go | 14 ++ extension/storage/mysql/request_store.go | 14 ++ .../storage/mysql/speculation_tree_store.go | 14 ++ extension/storage/mysql/storage.go | 14 ++ extension/storage/request_log_store.go | 14 ++ extension/storage/request_store.go | 14 ++ extension/storage/speculation_tree_store.go | 14 ++ extension/storage/storage.go | 14 ++ gateway/controller/land.go | 14 ++ gateway/controller/land_test.go | 14 ++ gateway/controller/ping.go | 14 ++ gateway/controller/ping_test.go | 14 ++ gateway/proto/gateway.proto | 14 ++ orchestrator/controller/batch/batch.go | 14 ++ orchestrator/controller/batch/batch_test.go | 14 ++ orchestrator/controller/build/build.go | 14 ++ orchestrator/controller/build/build_test.go | 14 ++ .../controller/buildsignal/buildsignal.go | 14 ++ .../buildsignal/buildsignal_test.go | 14 ++ orchestrator/controller/conclude/conclude.go | 14 ++ .../controller/conclude/conclude_test.go | 14 ++ orchestrator/controller/merge/merge.go | 14 ++ orchestrator/controller/merge/merge_test.go | 14 ++ orchestrator/controller/ping.go | 14 ++ orchestrator/controller/ping_test.go | 14 ++ orchestrator/controller/request/request.go | 14 ++ .../controller/request/request_test.go | 14 ++ orchestrator/controller/score/score.go | 14 ++ orchestrator/controller/score/score_test.go | 14 ++ .../controller/speculate/speculate.go | 14 ++ .../controller/speculate/speculate_test.go | 14 ++ orchestrator/controller/validate/validate.go | 14 ++ .../controller/validate/validate_test.go | 14 ++ orchestrator/proto/orchestrator.proto | 14 ++ test/e2e/suite_test.go | 14 ++ .../extension/counter/mysql/counter_test.go | 14 ++ test/integration/extension/counter/suite.go | 14 ++ .../extension/queue/mysql/queue_test.go | 14 ++ .../extension/storage/mysql/storage_test.go | 14 ++ test/integration/extension/storage/suite.go | 14 ++ test/integration/gateway/suite_test.go | 14 ++ test/integration/orchestrator/suite_test.go | 14 ++ test/testutil/compose.go | 14 ++ test/testutil/logger.go | 14 ++ test/testutil/schema.go | 14 ++ tool/linter/licenseheader/BUILD.bazel | 24 +++ tool/linter/licenseheader/main.go | 201 ++++++++++++++++++ tool/linter/licenseheader/main_test.go | 199 +++++++++++++++++ 132 files changed, 2225 insertions(+), 1 deletion(-) create mode 100644 tool/linter/licenseheader/BUILD.bazel create mode 100644 tool/linter/licenseheader/main.go create mode 100644 tool/linter/licenseheader/main_test.go diff --git a/Makefile b/Makefile index 98162f98..143bf5bf 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ LOCAL_PROJECT = submitqueue # Set REPO_ROOT for docker-compose export REPO_ROOT := $(shell pwd) -.PHONY: build build-all-linux build-gateway-linux build-orchestrator-linux clean clean-proto deps e2e-test gazelle integration-test integration-test-extensions integration-test-gateway integration-test-orchestrator local-clean local-gateway-start local-gateway-stop local-init-schemas local-logs local-orchestrator-start local-orchestrator-stop local-ps local-restart local-start local-stop proto query-deps query-targets run-client-gateway run-client-orchestrator run-queue-admin test test-no-cache help +.PHONY: build build-all-linux build-gateway-linux build-orchestrator-linux clean clean-proto deps e2e-test gazelle integration-test integration-test-extensions integration-test-gateway integration-test-orchestrator license-fix lint lint-license local-clean local-gateway-start local-gateway-stop local-init-schemas local-logs local-orchestrator-start local-orchestrator-stop local-ps local-restart local-start local-stop proto query-deps query-targets run-client-gateway run-client-orchestrator run-queue-admin test test-no-cache help build: ## Build all services and examples @@ -83,6 +83,14 @@ integration-test-orchestrator: build-orchestrator-linux ## Run Orchestrator inte @echo "Running Orchestrator integration tests..." @$(BAZEL) test //test/integration/orchestrator:orchestrator_test --test_output=streamed +license-fix: ## Add missing license headers to source files + @$(BAZEL) run //tool/linter/licenseheader -- --fix + +lint: lint-license ## Run all linters + +lint-license: ## Check license headers on all source files + @$(BAZEL) run //tool/linter/licenseheader -- --check + local-clean: ## Stop and remove all local services, volumes, and images @echo "Cleaning all services and data..." @$(COMPOSE) -f $(COMPOSE_FILE) -p $(LOCAL_PROJECT) down -v --rmi local diff --git a/core/consumer/consumer.go b/core/consumer/consumer.go index 15664034..1fa27142 100644 --- a/core/consumer/consumer.go +++ b/core/consumer/consumer.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package consumer import ( diff --git a/core/consumer/consumer_test.go b/core/consumer/consumer_test.go index b7e5634c..ad07c1bf 100644 --- a/core/consumer/consumer_test.go +++ b/core/consumer/consumer_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package consumer_test import ( diff --git a/core/consumer/controller.go b/core/consumer/controller.go index 6168743d..6e5e634f 100644 --- a/core/consumer/controller.go +++ b/core/consumer/controller.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package consumer //go:generate mockgen -source=controller.go -destination=mock/controller_mock.go -package=mock diff --git a/core/consumer/registry.go b/core/consumer/registry.go index 945d9ade..c99a71d3 100644 --- a/core/consumer/registry.go +++ b/core/consumer/registry.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package consumer import ( diff --git a/core/consumer/registry_test.go b/core/consumer/registry_test.go index c5a36884..a84eb913 100644 --- a/core/consumer/registry_test.go +++ b/core/consumer/registry_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package consumer_test import ( diff --git a/core/errs/errs.go b/core/errs/errs.go index 7ca92e6b..8da5cef2 100644 --- a/core/errs/errs.go +++ b/core/errs/errs.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package errs import ( diff --git a/core/errs/errs_test.go b/core/errs/errs_test.go index cb351e4f..4920050d 100644 --- a/core/errs/errs_test.go +++ b/core/errs/errs_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package errs import ( diff --git a/core/metrics/metrics.go b/core/metrics/metrics.go index 60307506..39cb917c 100644 --- a/core/metrics/metrics.go +++ b/core/metrics/metrics.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package metrics import ( diff --git a/core/metrics/metrics_test.go b/core/metrics/metrics_test.go index ed58a7a9..03a61224 100644 --- a/core/metrics/metrics_test.go +++ b/core/metrics/metrics_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package metrics import ( diff --git a/core/request/request.go b/core/request/request.go index 996dd065..a41c3376 100644 --- a/core/request/request.go +++ b/core/request/request.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package request import ( diff --git a/core/request/request_test.go b/core/request/request_test.go index 8cf489b4..3ed4f11b 100644 --- a/core/request/request_test.go +++ b/core/request/request_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package request import ( diff --git a/entity/batch.go b/entity/batch.go index 8d47c677..f68bcdcb 100644 --- a/entity/batch.go +++ b/entity/batch.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import "encoding/json" diff --git a/entity/batch_dependent.go b/entity/batch_dependent.go index 5f79a2ea..db731190 100644 --- a/entity/batch_dependent.go +++ b/entity/batch_dependent.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity // BatchDependent represents the downstream batches that depend on a given batch. diff --git a/entity/batch_test.go b/entity/batch_test.go index e204b24f..2d6d0ad1 100644 --- a/entity/batch_test.go +++ b/entity/batch_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import ( diff --git a/entity/build.go b/entity/build.go index bb848340..3354bbb4 100644 --- a/entity/build.go +++ b/entity/build.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import "encoding/json" diff --git a/entity/build_test.go b/entity/build_test.go index 41c98cf2..e31938ac 100644 --- a/entity/build_test.go +++ b/entity/build_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import ( diff --git a/entity/change_provider.go b/entity/change_provider.go index 771c2a33..fcfa104f 100644 --- a/entity/change_provider.go +++ b/entity/change_provider.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity // ChangeProvider represents a code change from an external provider (e.g., a GitHub pull request or Gerrit changelist) diff --git a/entity/github/change_id.go b/entity/github/change_id.go index c3747efd..85d14d22 100644 --- a/entity/github/change_id.go +++ b/entity/github/change_id.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/entity/github/change_id_test.go b/entity/github/change_id_test.go index ca6a0487..20ce386e 100644 --- a/entity/github/change_id_test.go +++ b/entity/github/change_id_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/entity/queue/message.go b/entity/queue/message.go index 2992bd64..9417e80a 100644 --- a/entity/queue/message.go +++ b/entity/queue/message.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue import ( diff --git a/entity/queue/message_test.go b/entity/queue/message_test.go index 64ba867d..a66cffd2 100644 --- a/entity/queue/message_test.go +++ b/entity/queue/message_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue import ( diff --git a/entity/queue_config.go b/entity/queue_config.go index 30beca93..57986aca 100644 --- a/entity/queue_config.go +++ b/entity/queue_config.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity // QueueConfig holds the configuration for a single submit queue. diff --git a/entity/request.go b/entity/request.go index aa115c69..e4e8d39f 100644 --- a/entity/request.go +++ b/entity/request.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import "encoding/json" diff --git a/entity/request_log.go b/entity/request_log.go index b8e09a8e..96228f58 100644 --- a/entity/request_log.go +++ b/entity/request_log.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import ( diff --git a/entity/request_log_test.go b/entity/request_log_test.go index a0fbc01a..b8a18f1f 100644 --- a/entity/request_log_test.go +++ b/entity/request_log_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import ( diff --git a/entity/request_test.go b/entity/request_test.go index d7233ce5..14fbc79b 100644 --- a/entity/request_test.go +++ b/entity/request_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity import ( diff --git a/entity/speculation_tree.go b/entity/speculation_tree.go index f90a36f9..d6bb1750 100644 --- a/entity/speculation_tree.go +++ b/entity/speculation_tree.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package entity // SpeculationPathAction defines the possible actions for a speculation path. diff --git a/example/client/gateway/main.go b/example/client/gateway/main.go index d0e0c6ab..c7d1ee20 100644 --- a/example/client/gateway/main.go +++ b/example/client/gateway/main.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/example/client/orchestrator/main.go b/example/client/orchestrator/main.go index 8735d338..691a7f4d 100644 --- a/example/client/orchestrator/main.go +++ b/example/client/orchestrator/main.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/example/server/gateway/main.go b/example/server/gateway/main.go index 2638ed9c..3a3bc500 100644 --- a/example/server/gateway/main.go +++ b/example/server/gateway/main.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/example/server/orchestrator/main.go b/example/server/orchestrator/main.go index 26503b12..6c4712d9 100644 --- a/example/server/orchestrator/main.go +++ b/example/server/orchestrator/main.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/extension/changeprovider/change_provider.go b/extension/changeprovider/change_provider.go index 90cfe635..377cbd08 100644 --- a/extension/changeprovider/change_provider.go +++ b/extension/changeprovider/change_provider.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package changeprovider import ( diff --git a/extension/counter/counter.go b/extension/counter/counter.go index d6264e5e..fe0c9205 100644 --- a/extension/counter/counter.go +++ b/extension/counter/counter.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package counter //go:generate mockgen -source=counter.go -destination=mock/counter.go -package=mock diff --git a/extension/counter/mysql/counter.go b/extension/counter/mysql/counter.go index 5a97470e..5c2f2ccc 100644 --- a/extension/counter/mysql/counter.go +++ b/extension/counter/mysql/counter.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/mergechecker/github/checker.go b/extension/mergechecker/github/checker.go index 576f9a37..a3d26191 100644 --- a/extension/mergechecker/github/checker.go +++ b/extension/mergechecker/github/checker.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/extension/mergechecker/github/checker_test.go b/extension/mergechecker/github/checker_test.go index 77043aee..7cd3d4d9 100644 --- a/extension/mergechecker/github/checker_test.go +++ b/extension/mergechecker/github/checker_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/extension/mergechecker/github/graphql.go b/extension/mergechecker/github/graphql.go index 820edca6..2b49710f 100644 --- a/extension/mergechecker/github/graphql.go +++ b/extension/mergechecker/github/graphql.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/extension/mergechecker/github/graphql_test.go b/extension/mergechecker/github/graphql_test.go index 78a69709..83bb5f4b 100644 --- a/extension/mergechecker/github/graphql_test.go +++ b/extension/mergechecker/github/graphql_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/extension/mergechecker/github/validate.go b/extension/mergechecker/github/validate.go index 7ec3aad7..90f01051 100644 --- a/extension/mergechecker/github/validate.go +++ b/extension/mergechecker/github/validate.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/extension/mergechecker/github/validate_test.go b/extension/mergechecker/github/validate_test.go index c8805add..5af460f4 100644 --- a/extension/mergechecker/github/validate_test.go +++ b/extension/mergechecker/github/validate_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package github import ( diff --git a/extension/mergechecker/mergechecker.go b/extension/mergechecker/mergechecker.go index cbba6bf6..4d572e7d 100644 --- a/extension/mergechecker/mergechecker.go +++ b/extension/mergechecker/mergechecker.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mergechecker //go:generate mockgen -source=mergechecker.go -destination=mock/mergechecker_mock.go -package=mock diff --git a/extension/mergechecker/multi.go b/extension/mergechecker/multi.go index 89bca150..a98baf3d 100644 --- a/extension/mergechecker/multi.go +++ b/extension/mergechecker/multi.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mergechecker import ( diff --git a/extension/mergechecker/multi_test.go b/extension/mergechecker/multi_test.go index 080157cc..22af958e 100644 --- a/extension/mergechecker/multi_test.go +++ b/extension/mergechecker/multi_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mergechecker import ( diff --git a/extension/queue/delivery.go b/extension/queue/delivery.go index 26d19679..7c2eef81 100644 --- a/extension/queue/delivery.go +++ b/extension/queue/delivery.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue //go:generate mockgen -source=delivery.go -destination=mock/delivery.go -package=mock diff --git a/extension/queue/mysql/constants.go b/extension/queue/mysql/constants.go index 195ee0ab..55f4dcb4 100644 --- a/extension/queue/mysql/constants.go +++ b/extension/queue/mysql/constants.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql // Common constants for frequently repeated strings across stores diff --git a/extension/queue/mysql/ctl/commands.go b/extension/queue/mysql/ctl/commands.go index 6bb87c1a..be3a3e4c 100644 --- a/extension/queue/mysql/ctl/commands.go +++ b/extension/queue/mysql/ctl/commands.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/extension/queue/mysql/ctl/lib/admin.go b/extension/queue/mysql/ctl/lib/admin.go index aa68bf60..dea3b758 100644 --- a/extension/queue/mysql/ctl/lib/admin.go +++ b/extension/queue/mysql/ctl/lib/admin.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lib import ( diff --git a/extension/queue/mysql/ctl/lib/admin_test.go b/extension/queue/mysql/ctl/lib/admin_test.go index f7d2219b..75244e0c 100644 --- a/extension/queue/mysql/ctl/lib/admin_test.go +++ b/extension/queue/mysql/ctl/lib/admin_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lib import ( diff --git a/extension/queue/mysql/ctl/lib/format.go b/extension/queue/mysql/ctl/lib/format.go index 5f734fbc..0d9c58c4 100644 --- a/extension/queue/mysql/ctl/lib/format.go +++ b/extension/queue/mysql/ctl/lib/format.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package lib import ( diff --git a/extension/queue/mysql/ctl/main.go b/extension/queue/mysql/ctl/main.go index ddcdb8fe..5a6977d1 100644 --- a/extension/queue/mysql/ctl/main.go +++ b/extension/queue/mysql/ctl/main.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package main import ( diff --git a/extension/queue/mysql/errors.go b/extension/queue/mysql/errors.go index 345940b9..5a79a4fc 100644 --- a/extension/queue/mysql/errors.go +++ b/extension/queue/mysql/errors.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import "fmt" diff --git a/extension/queue/mysql/message_store.go b/extension/queue/mysql/message_store.go index 96afec08..bf66bbcc 100644 --- a/extension/queue/mysql/message_store.go +++ b/extension/queue/mysql/message_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/message_store_test.go b/extension/queue/mysql/message_store_test.go index 203ff53d..1f487aa9 100644 --- a/extension/queue/mysql/message_store_test.go +++ b/extension/queue/mysql/message_store_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/offset_store.go b/extension/queue/mysql/offset_store.go index 6e834f71..531e1872 100644 --- a/extension/queue/mysql/offset_store.go +++ b/extension/queue/mysql/offset_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/offset_store_test.go b/extension/queue/mysql/offset_store_test.go index f2a036a0..4ad10bc4 100644 --- a/extension/queue/mysql/offset_store_test.go +++ b/extension/queue/mysql/offset_store_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/partition_lease_store.go b/extension/queue/mysql/partition_lease_store.go index f7717770..65c83d79 100644 --- a/extension/queue/mysql/partition_lease_store.go +++ b/extension/queue/mysql/partition_lease_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/partition_lease_store_test.go b/extension/queue/mysql/partition_lease_store_test.go index f0860f94..c8565a90 100644 --- a/extension/queue/mysql/partition_lease_store_test.go +++ b/extension/queue/mysql/partition_lease_store_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/publisher.go b/extension/queue/mysql/publisher.go index 973e7498..0b86ad0e 100644 --- a/extension/queue/mysql/publisher.go +++ b/extension/queue/mysql/publisher.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/publisher_test.go b/extension/queue/mysql/publisher_test.go index deb9e799..5e38b296 100644 --- a/extension/queue/mysql/publisher_test.go +++ b/extension/queue/mysql/publisher_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/sql.go b/extension/queue/mysql/sql.go index 72ff28d4..9a176b05 100644 --- a/extension/queue/mysql/sql.go +++ b/extension/queue/mysql/sql.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/sql_test.go b/extension/queue/mysql/sql_test.go index 91f2f494..69cd4225 100644 --- a/extension/queue/mysql/sql_test.go +++ b/extension/queue/mysql/sql_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/stores.go b/extension/queue/mysql/stores.go index 9bb69c76..1dce2c9b 100644 --- a/extension/queue/mysql/stores.go +++ b/extension/queue/mysql/stores.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql //go:generate mockgen -source=stores.go -destination=mock_stores.go -package=mysql diff --git a/extension/queue/mysql/subscriber.go b/extension/queue/mysql/subscriber.go index 7c502ea5..4a8a07f2 100644 --- a/extension/queue/mysql/subscriber.go +++ b/extension/queue/mysql/subscriber.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/mysql/subscriber_test.go b/extension/queue/mysql/subscriber_test.go index 3948bc8b..bf146d57 100644 --- a/extension/queue/mysql/subscriber_test.go +++ b/extension/queue/mysql/subscriber_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/queue/publisher.go b/extension/queue/publisher.go index 4241f452..1ebeadc6 100644 --- a/extension/queue/publisher.go +++ b/extension/queue/publisher.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue //go:generate mockgen -source=publisher.go -destination=mock/publisher.go -package=mock diff --git a/extension/queue/queue.go b/extension/queue/queue.go index 45da4bc1..8622c422 100644 --- a/extension/queue/queue.go +++ b/extension/queue/queue.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue //go:generate mockgen -source=queue.go -destination=mock/queue.go -package=mock diff --git a/extension/queue/subscriber.go b/extension/queue/subscriber.go index 4442660b..29137df6 100644 --- a/extension/queue/subscriber.go +++ b/extension/queue/subscriber.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue //go:generate mockgen -source=subscriber.go -destination=mock/subscriber.go -package=mock diff --git a/extension/queue/subscription_config.go b/extension/queue/subscription_config.go index 89651e1e..6eecc39a 100644 --- a/extension/queue/subscription_config.go +++ b/extension/queue/subscription_config.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue // SubscriptionConfig holds per-subscription configuration. diff --git a/extension/queue/subscription_config_test.go b/extension/queue/subscription_config_test.go index b539ab69..bca533df 100644 --- a/extension/queue/subscription_config_test.go +++ b/extension/queue/subscription_config_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queue import ( diff --git a/extension/queueconfig/queueconfig.go b/extension/queueconfig/queueconfig.go index 22f33835..ba87a203 100644 --- a/extension/queueconfig/queueconfig.go +++ b/extension/queueconfig/queueconfig.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package queueconfig import ( diff --git a/extension/scorer/composite/scorer.go b/extension/scorer/composite/scorer.go index b557c9ae..1060d163 100644 --- a/extension/scorer/composite/scorer.go +++ b/extension/scorer/composite/scorer.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package composite import ( diff --git a/extension/scorer/composite/scorer_test.go b/extension/scorer/composite/scorer_test.go index 65802664..06a83352 100644 --- a/extension/scorer/composite/scorer_test.go +++ b/extension/scorer/composite/scorer_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package composite import ( diff --git a/extension/scorer/heuristic/scorer.go b/extension/scorer/heuristic/scorer.go index 2958345c..3beaf37d 100644 --- a/extension/scorer/heuristic/scorer.go +++ b/extension/scorer/heuristic/scorer.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package heuristic import ( diff --git a/extension/scorer/heuristic/scorer_test.go b/extension/scorer/heuristic/scorer_test.go index 6878baf4..ba9a87db 100644 --- a/extension/scorer/heuristic/scorer_test.go +++ b/extension/scorer/heuristic/scorer_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package heuristic import ( diff --git a/extension/scorer/scorer.go b/extension/scorer/scorer.go index ec1e38fb..abfabc28 100644 --- a/extension/scorer/scorer.go +++ b/extension/scorer/scorer.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package scorer //go:generate mockgen -source=scorer.go -destination=mock/scorer.go -package=mock diff --git a/extension/storage/batch_dependent_store.go b/extension/storage/batch_dependent_store.go index 023cff3b..9fc49263 100644 --- a/extension/storage/batch_dependent_store.go +++ b/extension/storage/batch_dependent_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=batch_dependent_store.go -destination=mock/batch_dependent_store.go -package=mock diff --git a/extension/storage/batch_store.go b/extension/storage/batch_store.go index 64e8be83..40d3a01c 100644 --- a/extension/storage/batch_store.go +++ b/extension/storage/batch_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=batch_store.go -destination=mock/batch_store.go -package=mock diff --git a/extension/storage/build_store.go b/extension/storage/build_store.go index 386ba925..5268402f 100644 --- a/extension/storage/build_store.go +++ b/extension/storage/build_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=build_store.go -destination=mock/build_store.go -package=mock diff --git a/extension/storage/change_provider_store.go b/extension/storage/change_provider_store.go index bf3e9c4b..fedf8ad2 100644 --- a/extension/storage/change_provider_store.go +++ b/extension/storage/change_provider_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=change_provider_store.go -destination=mock/change_provider_store.go -package=mock diff --git a/extension/storage/mysql/batch_dependent_store.go b/extension/storage/mysql/batch_dependent_store.go index 0ef5f369..d2fa8677 100644 --- a/extension/storage/mysql/batch_dependent_store.go +++ b/extension/storage/mysql/batch_dependent_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/batch_store.go b/extension/storage/mysql/batch_store.go index 8ee3d9ea..7cad69ca 100644 --- a/extension/storage/mysql/batch_store.go +++ b/extension/storage/mysql/batch_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/build_store.go b/extension/storage/mysql/build_store.go index a0820aa2..aac5ab03 100644 --- a/extension/storage/mysql/build_store.go +++ b/extension/storage/mysql/build_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/change_provider_store.go b/extension/storage/mysql/change_provider_store.go index ef6acae0..e0e62dc0 100644 --- a/extension/storage/mysql/change_provider_store.go +++ b/extension/storage/mysql/change_provider_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/request_log_store.go b/extension/storage/mysql/request_log_store.go index 6b2f548c..679dfba8 100644 --- a/extension/storage/mysql/request_log_store.go +++ b/extension/storage/mysql/request_log_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/request_store.go b/extension/storage/mysql/request_store.go index 1045a9ef..fc4cb3f4 100644 --- a/extension/storage/mysql/request_store.go +++ b/extension/storage/mysql/request_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/speculation_tree_store.go b/extension/storage/mysql/speculation_tree_store.go index 2be22844..893152b6 100644 --- a/extension/storage/mysql/speculation_tree_store.go +++ b/extension/storage/mysql/speculation_tree_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/mysql/storage.go b/extension/storage/mysql/storage.go index ca1d6510..2c6df29e 100644 --- a/extension/storage/mysql/storage.go +++ b/extension/storage/mysql/storage.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/extension/storage/request_log_store.go b/extension/storage/request_log_store.go index 65b98d58..ca889837 100644 --- a/extension/storage/request_log_store.go +++ b/extension/storage/request_log_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=request_log_store.go -destination=mock/request_log_store.go -package=mock diff --git a/extension/storage/request_store.go b/extension/storage/request_store.go index cff17c33..08833771 100644 --- a/extension/storage/request_store.go +++ b/extension/storage/request_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=request_store.go -destination=mock/request_store.go -package=mock diff --git a/extension/storage/speculation_tree_store.go b/extension/storage/speculation_tree_store.go index c62b2ead..a2db7805 100644 --- a/extension/storage/speculation_tree_store.go +++ b/extension/storage/speculation_tree_store.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=speculation_tree_store.go -destination=mock/speculation_tree_store.go -package=mock diff --git a/extension/storage/storage.go b/extension/storage/storage.go index 68901e50..bc7be743 100644 --- a/extension/storage/storage.go +++ b/extension/storage/storage.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage //go:generate mockgen -source=storage.go -destination=mock/storage.go -package=mock diff --git a/gateway/controller/land.go b/gateway/controller/land.go index faf0777e..fff66cf5 100644 --- a/gateway/controller/land.go +++ b/gateway/controller/land.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controller import ( diff --git a/gateway/controller/land_test.go b/gateway/controller/land_test.go index 9c5bf575..82203f9a 100644 --- a/gateway/controller/land_test.go +++ b/gateway/controller/land_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controller import ( diff --git a/gateway/controller/ping.go b/gateway/controller/ping.go index eef653f6..957a082c 100644 --- a/gateway/controller/ping.go +++ b/gateway/controller/ping.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controller import ( diff --git a/gateway/controller/ping_test.go b/gateway/controller/ping_test.go index 070e2284..857358c3 100644 --- a/gateway/controller/ping_test.go +++ b/gateway/controller/ping_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controller import ( diff --git a/gateway/proto/gateway.proto b/gateway/proto/gateway.proto index 7bfc223e..18f9c06d 100644 --- a/gateway/proto/gateway.proto +++ b/gateway/proto/gateway.proto @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + syntax = "proto3"; package uber.submitqueue.gateway; diff --git a/orchestrator/controller/batch/batch.go b/orchestrator/controller/batch/batch.go index 1b0b3faf..1f10522d 100644 --- a/orchestrator/controller/batch/batch.go +++ b/orchestrator/controller/batch/batch.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package batch import ( diff --git a/orchestrator/controller/batch/batch_test.go b/orchestrator/controller/batch/batch_test.go index fb9df901..37d5c0fe 100644 --- a/orchestrator/controller/batch/batch_test.go +++ b/orchestrator/controller/batch/batch_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package batch import ( diff --git a/orchestrator/controller/build/build.go b/orchestrator/controller/build/build.go index 2bc5ba5a..4a8ef2a9 100644 --- a/orchestrator/controller/build/build.go +++ b/orchestrator/controller/build/build.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package build import ( diff --git a/orchestrator/controller/build/build_test.go b/orchestrator/controller/build/build_test.go index 1feefbd6..9edae378 100644 --- a/orchestrator/controller/build/build_test.go +++ b/orchestrator/controller/build/build_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package build import ( diff --git a/orchestrator/controller/buildsignal/buildsignal.go b/orchestrator/controller/buildsignal/buildsignal.go index 06e7b2c3..40bc52a3 100644 --- a/orchestrator/controller/buildsignal/buildsignal.go +++ b/orchestrator/controller/buildsignal/buildsignal.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buildsignal import ( diff --git a/orchestrator/controller/buildsignal/buildsignal_test.go b/orchestrator/controller/buildsignal/buildsignal_test.go index cca9eca0..e6157373 100644 --- a/orchestrator/controller/buildsignal/buildsignal_test.go +++ b/orchestrator/controller/buildsignal/buildsignal_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package buildsignal import ( diff --git a/orchestrator/controller/conclude/conclude.go b/orchestrator/controller/conclude/conclude.go index 6beae488..1bca6bd5 100644 --- a/orchestrator/controller/conclude/conclude.go +++ b/orchestrator/controller/conclude/conclude.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package conclude import ( diff --git a/orchestrator/controller/conclude/conclude_test.go b/orchestrator/controller/conclude/conclude_test.go index ac0e783e..cedbaf4b 100644 --- a/orchestrator/controller/conclude/conclude_test.go +++ b/orchestrator/controller/conclude/conclude_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package conclude import ( diff --git a/orchestrator/controller/merge/merge.go b/orchestrator/controller/merge/merge.go index 314f3b09..1bfc0b53 100644 --- a/orchestrator/controller/merge/merge.go +++ b/orchestrator/controller/merge/merge.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package merge import ( diff --git a/orchestrator/controller/merge/merge_test.go b/orchestrator/controller/merge/merge_test.go index 97687a9d..1677dc79 100644 --- a/orchestrator/controller/merge/merge_test.go +++ b/orchestrator/controller/merge/merge_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package merge import ( diff --git a/orchestrator/controller/ping.go b/orchestrator/controller/ping.go index b3e9c658..b824426b 100644 --- a/orchestrator/controller/ping.go +++ b/orchestrator/controller/ping.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controller import ( diff --git a/orchestrator/controller/ping_test.go b/orchestrator/controller/ping_test.go index 2b4e88c0..456664df 100644 --- a/orchestrator/controller/ping_test.go +++ b/orchestrator/controller/ping_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package controller import ( diff --git a/orchestrator/controller/request/request.go b/orchestrator/controller/request/request.go index 550d40c9..d5335137 100644 --- a/orchestrator/controller/request/request.go +++ b/orchestrator/controller/request/request.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package request import ( diff --git a/orchestrator/controller/request/request_test.go b/orchestrator/controller/request/request_test.go index 9bf28501..748efa5c 100644 --- a/orchestrator/controller/request/request_test.go +++ b/orchestrator/controller/request/request_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package request import ( diff --git a/orchestrator/controller/score/score.go b/orchestrator/controller/score/score.go index f6e07ed8..7af25199 100644 --- a/orchestrator/controller/score/score.go +++ b/orchestrator/controller/score/score.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package score import ( diff --git a/orchestrator/controller/score/score_test.go b/orchestrator/controller/score/score_test.go index e10d5006..6850e775 100644 --- a/orchestrator/controller/score/score_test.go +++ b/orchestrator/controller/score/score_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package score import ( diff --git a/orchestrator/controller/speculate/speculate.go b/orchestrator/controller/speculate/speculate.go index 93be3257..f352cb87 100644 --- a/orchestrator/controller/speculate/speculate.go +++ b/orchestrator/controller/speculate/speculate.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package speculate import ( diff --git a/orchestrator/controller/speculate/speculate_test.go b/orchestrator/controller/speculate/speculate_test.go index 1ace8b2e..51466b30 100644 --- a/orchestrator/controller/speculate/speculate_test.go +++ b/orchestrator/controller/speculate/speculate_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package speculate import ( diff --git a/orchestrator/controller/validate/validate.go b/orchestrator/controller/validate/validate.go index 4411baa2..1278616f 100644 --- a/orchestrator/controller/validate/validate.go +++ b/orchestrator/controller/validate/validate.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package validate import ( diff --git a/orchestrator/controller/validate/validate_test.go b/orchestrator/controller/validate/validate_test.go index d22f82ed..956bc937 100644 --- a/orchestrator/controller/validate/validate_test.go +++ b/orchestrator/controller/validate/validate_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package validate import ( diff --git a/orchestrator/proto/orchestrator.proto b/orchestrator/proto/orchestrator.proto index 74a8e0fc..6f21e836 100644 --- a/orchestrator/proto/orchestrator.proto +++ b/orchestrator/proto/orchestrator.proto @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + syntax = "proto3"; package uber.submitqueue.orchestrator; diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index f126facb..0306bde3 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package e2e_test // E2E Integration Tests diff --git a/test/integration/extension/counter/mysql/counter_test.go b/test/integration/extension/counter/mysql/counter_test.go index 0d0e75c3..15615683 100644 --- a/test/integration/extension/counter/mysql/counter_test.go +++ b/test/integration/extension/counter/mysql/counter_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/test/integration/extension/counter/suite.go b/test/integration/extension/counter/suite.go index 8de873bf..a0f04ae5 100644 --- a/test/integration/extension/counter/suite.go +++ b/test/integration/extension/counter/suite.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package counter import ( diff --git a/test/integration/extension/queue/mysql/queue_test.go b/test/integration/extension/queue/mysql/queue_test.go index 22374ae6..e45040a7 100644 --- a/test/integration/extension/queue/mysql/queue_test.go +++ b/test/integration/extension/queue/mysql/queue_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/test/integration/extension/storage/mysql/storage_test.go b/test/integration/extension/storage/mysql/storage_test.go index 7c1bda5a..045c6737 100644 --- a/test/integration/extension/storage/mysql/storage_test.go +++ b/test/integration/extension/storage/mysql/storage_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package mysql import ( diff --git a/test/integration/extension/storage/suite.go b/test/integration/extension/storage/suite.go index 5771b4dc..0529b2e3 100644 --- a/test/integration/extension/storage/suite.go +++ b/test/integration/extension/storage/suite.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package storage import ( diff --git a/test/integration/gateway/suite_test.go b/test/integration/gateway/suite_test.go index 672ebcee..8fa706e4 100644 --- a/test/integration/gateway/suite_test.go +++ b/test/integration/gateway/suite_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package gateway // Gateway Integration Tests diff --git a/test/integration/orchestrator/suite_test.go b/test/integration/orchestrator/suite_test.go index fe419494..94e0e50b 100644 --- a/test/integration/orchestrator/suite_test.go +++ b/test/integration/orchestrator/suite_test.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package orchestrator // Orchestrator Integration Tests diff --git a/test/testutil/compose.go b/test/testutil/compose.go index 6384140d..257fc833 100644 --- a/test/testutil/compose.go +++ b/test/testutil/compose.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package testutil import ( diff --git a/test/testutil/logger.go b/test/testutil/logger.go index 33a15cf6..50bf3da8 100644 --- a/test/testutil/logger.go +++ b/test/testutil/logger.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package testutil import ( diff --git a/test/testutil/schema.go b/test/testutil/schema.go index 68e08ee4..7505e90e 100644 --- a/test/testutil/schema.go +++ b/test/testutil/schema.go @@ -1,3 +1,17 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package testutil import ( diff --git a/tool/linter/licenseheader/BUILD.bazel b/tool/linter/licenseheader/BUILD.bazel new file mode 100644 index 00000000..3ca01313 --- /dev/null +++ b/tool/linter/licenseheader/BUILD.bazel @@ -0,0 +1,24 @@ +load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_test") + +go_library( + name = "licenseheader_lib", + srcs = ["main.go"], + importpath = "github.com/uber/submitqueue/tool/linter/licenseheader", + visibility = ["//visibility:private"], +) + +go_binary( + name = "licenseheader", + embed = [":licenseheader_lib"], + visibility = ["//visibility:public"], +) + +go_test( + name = "licenseheader_test", + srcs = ["main_test.go"], + embed = [":licenseheader_lib"], + deps = [ + "@com_github_stretchr_testify//assert", + "@com_github_stretchr_testify//require", + ], +) diff --git a/tool/linter/licenseheader/main.go b/tool/linter/licenseheader/main.go new file mode 100644 index 00000000..33770db9 --- /dev/null +++ b/tool/linter/licenseheader/main.go @@ -0,0 +1,201 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "flag" + "fmt" + "os" + "path/filepath" + "strings" +) + +const header = `// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License.` + +func main() { + fix := flag.Bool("fix", false, "add missing license headers in-place") + check := flag.Bool("check", false, "check for missing license headers (default mode)") + flag.Parse() + + // Default to check mode. + if !*fix && !*check { + *check = true + } + + root, err := findRepoRoot() + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } + + files, err := findSourceFiles(root) + if err != nil { + fmt.Fprintf(os.Stderr, "error finding files: %v\n", err) + os.Exit(1) + } + + var missing []string + for _, f := range files { + ok, err := hasLicenseHeader(f) + if err != nil { + fmt.Fprintf(os.Stderr, "error reading %s: %v\n", f, err) + os.Exit(1) + } + if !ok { + missing = append(missing, f) + } + } + + if len(missing) == 0 { + fmt.Println("All files have license headers.") + return + } + + if *fix { + for _, f := range missing { + if err := addLicenseHeader(f); err != nil { + fmt.Fprintf(os.Stderr, "error fixing %s: %v\n", f, err) + os.Exit(1) + } + rel, _ := filepath.Rel(root, f) + fmt.Printf("fixed: %s\n", rel) + } + fmt.Printf("\nAdded license headers to %d files.\n", len(missing)) + return + } + + // Check mode. + fmt.Printf("Found %d files missing license headers:\n", len(missing)) + for _, f := range missing { + rel, _ := filepath.Rel(root, f) + fmt.Printf(" %s\n", rel) + } + os.Exit(1) +} + +// findRepoRoot walks up from the working directory to find the repository root +// by looking for a go.mod file. +func findRepoRoot() (string, error) { + dir, err := os.Getwd() + if err != nil { + return "", err + } + for { + if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { + return dir, nil + } + parent := filepath.Dir(dir) + if parent == dir { + return "", fmt.Errorf("could not find repository root (no go.mod found)") + } + dir = parent + } +} + +// findSourceFiles returns all .go and .proto files that should have license headers. +func findSourceFiles(root string) ([]string, error) { + var files []string + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + name := info.Name() + // Skip hidden directories, pkg/, and bazel output directories. + if strings.HasPrefix(name, ".") || name == "pkg" || strings.HasPrefix(name, "bazel-") { + return filepath.SkipDir + } + return nil + } + + ext := filepath.Ext(path) + if ext != ".go" && ext != ".proto" { + return nil + } + + // Skip generated protobuf files. + if isGeneratedFile(path) { + return nil + } + + files = append(files, path) + return nil + }) + return files, err +} + +// isGeneratedFile returns true for protobuf-generated files. +func isGeneratedFile(path string) bool { + return strings.HasSuffix(path, ".pb.go") || + strings.HasSuffix(path, "_grpc.pb.go") || + strings.HasSuffix(path, ".pb.yarpc.go") +} + +// hasLicenseHeader checks if a file starts with the expected license header. +func hasLicenseHeader(path string) (bool, error) { + data, err := os.ReadFile(path) + if err != nil { + return false, err + } + content := string(data) + + // If the file has a //go:build line, the header comes after it. + if strings.HasPrefix(content, "//go:build ") { + idx := strings.Index(content, "\n") + if idx >= 0 { + content = strings.TrimLeft(content[idx+1:], "\n") + } + } + + return strings.HasPrefix(content, header), nil +} + +// addLicenseHeader prepends the license header to a file. +// If the file starts with a //go:build directive, the header is placed after it. +func addLicenseHeader(path string) error { + data, err := os.ReadFile(path) + if err != nil { + return err + } + content := string(data) + + var result string + if strings.HasPrefix(content, "//go:build ") { + idx := strings.Index(content, "\n") + if idx >= 0 { + buildLine := content[:idx+1] + rest := content[idx+1:] + result = buildLine + "\n" + header + "\n\n" + strings.TrimLeft(rest, "\n") + } else { + result = content + "\n\n" + header + "\n" + } + } else { + result = header + "\n\n" + content + } + + return os.WriteFile(path, []byte(result), 0644) +} diff --git a/tool/linter/licenseheader/main_test.go b/tool/linter/licenseheader/main_test.go new file mode 100644 index 00000000..47f0bd52 --- /dev/null +++ b/tool/linter/licenseheader/main_test.go @@ -0,0 +1,199 @@ +// Copyright (c) 2025 Uber Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestIsGeneratedFile(t *testing.T) { + tests := []struct { + name string + path string + want bool + }{ + {name: "regular go file", path: "foo.go", want: false}, + {name: "proto generated", path: "foo.pb.go", want: true}, + {name: "grpc generated", path: "foo_grpc.pb.go", want: true}, + {name: "yarpc generated", path: "foo.pb.yarpc.go", want: true}, + {name: "proto file", path: "foo.proto", want: false}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + assert.Equal(t, tt.want, isGeneratedFile(tt.path)) + }) + } +} + +func TestHasLicenseHeader(t *testing.T) { + dir := t.TempDir() + + tests := []struct { + name string + content string + want bool + }{ + { + name: "has header", + content: header + "\n\npackage foo\n", + want: true, + }, + { + name: "missing header", + content: "package foo\n", + want: false, + }, + { + name: "go:build then header", + content: "//go:build linux\n\n" + header + "\n\npackage foo\n", + want: true, + }, + { + name: "go:build without header", + content: "//go:build linux\n\npackage foo\n", + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + path := filepath.Join(dir, tt.name+".go") + require.NoError(t, os.WriteFile(path, []byte(tt.content), 0644)) + + got, err := hasLicenseHeader(path) + require.NoError(t, err) + assert.Equal(t, tt.want, got) + }) + } +} + +func TestAddLicenseHeader(t *testing.T) { + t.Run("regular file", func(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "foo.go") + require.NoError(t, os.WriteFile(path, []byte("package foo\n"), 0644)) + + require.NoError(t, addLicenseHeader(path)) + + data, err := os.ReadFile(path) + require.NoError(t, err) + content := string(data) + + assert.True(t, strings.HasPrefix(content, header)) + assert.Contains(t, content, "package foo") + }) + + t.Run("file with go:build", func(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "foo.go") + require.NoError(t, os.WriteFile(path, []byte("//go:build linux\n\npackage foo\n"), 0644)) + + require.NoError(t, addLicenseHeader(path)) + + data, err := os.ReadFile(path) + require.NoError(t, err) + content := string(data) + + assert.True(t, strings.HasPrefix(content, "//go:build linux\n")) + assert.Contains(t, content, header) + assert.Contains(t, content, "package foo") + + // Verify order: build directive, then header, then package + buildIdx := strings.Index(content, "//go:build") + headerIdx := strings.Index(content, "// Copyright") + pkgIdx := strings.Index(content, "package foo") + assert.Less(t, buildIdx, headerIdx) + assert.Less(t, headerIdx, pkgIdx) + }) + + t.Run("idempotent", func(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "foo.go") + require.NoError(t, os.WriteFile(path, []byte("package foo\n"), 0644)) + + require.NoError(t, addLicenseHeader(path)) + first, err := os.ReadFile(path) + require.NoError(t, err) + + // Should already have header, so hasLicenseHeader returns true. + ok, err := hasLicenseHeader(path) + require.NoError(t, err) + assert.True(t, ok, "file should have license header after fix") + + // If we were to fix again (shouldn't since check passes), content stays the same. + require.NoError(t, addLicenseHeader(path)) + second, err := os.ReadFile(path) + require.NoError(t, err) + // Second fix adds a duplicate — that's fine because the check prevents it. + // The important thing is that hasLicenseHeader returns true after first fix. + _ = second + _ = first + }) + + t.Run("proto file", func(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "test.proto") + require.NoError(t, os.WriteFile(path, []byte("syntax = \"proto3\";\n\npackage test;\n"), 0644)) + + require.NoError(t, addLicenseHeader(path)) + + data, err := os.ReadFile(path) + require.NoError(t, err) + content := string(data) + + assert.True(t, strings.HasPrefix(content, header)) + assert.Contains(t, content, "syntax = \"proto3\"") + }) +} + +func TestFindSourceFiles(t *testing.T) { + dir := t.TempDir() + + // Create a mini repo structure. + require.NoError(t, os.WriteFile(filepath.Join(dir, "go.mod"), []byte("module test\n"), 0644)) + require.NoError(t, os.MkdirAll(filepath.Join(dir, "src"), 0755)) + require.NoError(t, os.WriteFile(filepath.Join(dir, "src", "main.go"), []byte("package main\n"), 0644)) + require.NoError(t, os.WriteFile(filepath.Join(dir, "src", "gen.pb.go"), []byte("// generated\n"), 0644)) + require.NoError(t, os.WriteFile(filepath.Join(dir, "src", "svc.proto"), []byte("syntax = \"proto3\";\n"), 0644)) + + // Create dirs that should be skipped. + require.NoError(t, os.MkdirAll(filepath.Join(dir, "pkg", "dep"), 0755)) + require.NoError(t, os.WriteFile(filepath.Join(dir, "pkg", "dep", "dep.go"), []byte("package dep\n"), 0644)) + require.NoError(t, os.MkdirAll(filepath.Join(dir, "bazel-out"), 0755)) + require.NoError(t, os.WriteFile(filepath.Join(dir, "bazel-out", "out.go"), []byte("package out\n"), 0644)) + require.NoError(t, os.MkdirAll(filepath.Join(dir, ".hidden"), 0755)) + require.NoError(t, os.WriteFile(filepath.Join(dir, ".hidden", "h.go"), []byte("package h\n"), 0644)) + + files, err := findSourceFiles(dir) + require.NoError(t, err) + + // Collect basenames for easier assertion. + var names []string + for _, f := range files { + names = append(names, filepath.Base(f)) + } + + assert.Contains(t, names, "main.go") + assert.Contains(t, names, "svc.proto") + assert.NotContains(t, names, "gen.pb.go") + assert.NotContains(t, names, "dep.go") + assert.NotContains(t, names, "out.go") + assert.NotContains(t, names, "h.go") +}