diff --git a/Makefile b/Makefile index be540985c83..f101599d854 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ $(TOOLS_DIR)/stringer: $(TOOLS_MOD_DIR)/go.mod $(TOOLS_MOD_DIR)/go.sum $(TOOLS_M cd $(TOOLS_MOD_DIR) && \ go build -o $(TOOLS_DIR)/stringer golang.org/x/tools/cmd/stringer -precommit: generate build lint test +precommit: license-check generate build lint test .PHONY: test-with-coverage test-with-coverage: @@ -145,5 +145,16 @@ lint: $(TOOLS_DIR)/golangci-lint $(TOOLS_DIR)/misspell go mod tidy); \ done +.PHONY: generate generate: $(TOOLS_DIR)/stringer PATH="$(TOOLS_DIR):$${PATH}" go generate ./... + +.PHONY: license-check +license-check: + @licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path './vendor/*' ! -path './exporters/otlp/internal/opentelemetry-proto/*') ; do \ + awk '/Copyright The OpenTelemetry Authors|generated|GENERATED/ && NR<=3 { found=1; next } END { if (!found) print FILENAME }' $$f; \ + done); \ + if [ -n "$${licRes}" ]; then \ + echo "license header checking failed:"; echo "$${licRes}"; \ + exit 1; \ + fi diff --git a/doc.go b/doc.go index 122f50f1577..6c55ff6a2b6 100644 --- a/doc.go +++ b/doc.go @@ -1,3 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// 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. + // This package provides all of its functionality through its // submodules. The submodules in the exporters directory provide // implementations for trace and metric exporters for third-party diff --git a/exporters/metric/datadog/datadog.go b/exporters/metric/datadog/datadog.go index fd442324916..4391fe5a6fc 100644 --- a/exporters/metric/datadog/datadog.go +++ b/exporters/metric/datadog/datadog.go @@ -1,3 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// 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 datadog import ( diff --git a/exporters/metric/datadog/example_test.go b/exporters/metric/datadog/example_test.go index 8b00e4cf841..c04dcc7e609 100644 --- a/exporters/metric/datadog/example_test.go +++ b/exporters/metric/datadog/example_test.go @@ -1,3 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// 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 datadog_test import ( diff --git a/instrumentation/github.com/bradfitz/gomemcache/status.go b/instrumentation/github.com/bradfitz/gomemcache/status.go index 0f4fa59545f..0933b236a4a 100644 --- a/instrumentation/github.com/bradfitz/gomemcache/status.go +++ b/instrumentation/github.com/bradfitz/gomemcache/status.go @@ -1,3 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// 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 gomemcache import ( diff --git a/instrumentation/runtime/doc.go b/instrumentation/runtime/doc.go index f534cf9e104..4020b865989 100644 --- a/instrumentation/runtime/doc.go +++ b/instrumentation/runtime/doc.go @@ -1,3 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// 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 runtime implements the work-in-progress conventional runtime metrics specified by OpenTelemetry. // // The metrics produced are: diff --git a/tools/tools.go b/tools/tools.go index 6c4e08c445e..f449e286803 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,3 +1,17 @@ +// Copyright The OpenTelemetry Authors +// +// 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. + // +build tools package tools