diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 196763cb89..b5e7b7632c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -182,9 +182,9 @@ jobs: - name: "Code consistency checks" run: | - make fmtcheck importscheck generate staticcheck exhaustive protobuf copyright + make fmtcheck importscheck generate staticcheck exhaustive protobuf if [[ -n "$(git status --porcelain)" ]]; then - echo >&2 "ERROR: Generated files are inconsistent. Run 'make generate protobuf copyright' locally and then commit the updated files." + echo >&2 "ERROR: Generated files are inconsistent. Run 'make generate' and 'make protobuf' locally and then commit the updated files." git >&2 status --porcelain exit 1 fi diff --git a/Makefile b/Makefile index f2e17a1193..84a5dfabf5 100644 --- a/Makefile +++ b/Makefile @@ -26,9 +26,6 @@ staticcheck: exhaustive: "$(CURDIR)/scripts/exhaustive.sh" -copyright: - "$(CURDIR)/scripts/copyright.sh" - # Run this if working on the website locally to run in watch mode. website: $(MAKE) -C website website diff --git a/copyright_headers.go b/copyright_headers.go new file mode 100644 index 0000000000..7900ce788d --- /dev/null +++ b/copyright_headers.go @@ -0,0 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package main + +//go:generate go run github.com/hashicorp/copywrite headers diff --git a/docs/plugin-protocol/copyright_headers.go b/docs/plugin-protocol/copyright_headers.go new file mode 100644 index 0000000000..06fb0e9441 --- /dev/null +++ b/docs/plugin-protocol/copyright_headers.go @@ -0,0 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-1.1 + +package plugin_protocol + +//go:generate go run github.com/hashicorp/copywrite headers diff --git a/internal/tfplugin5/copyright_headers.go b/internal/tfplugin5/copyright_headers.go new file mode 100644 index 0000000000..ff7f9ca2d6 --- /dev/null +++ b/internal/tfplugin5/copyright_headers.go @@ -0,0 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-1.1 + +package tfplugin5 + +//go:generate go run github.com/hashicorp/copywrite headers diff --git a/internal/tfplugin6/copyright_headers.go b/internal/tfplugin6/copyright_headers.go new file mode 100644 index 0000000000..493fe6f362 --- /dev/null +++ b/internal/tfplugin6/copyright_headers.go @@ -0,0 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-1.1 + +package tfplugin6 + +//go:generate go run github.com/hashicorp/copywrite headers diff --git a/scripts/copyright.sh b/scripts/copyright.sh deleted file mode 100755 index 8ce102a89f..0000000000 --- a/scripts/copyright.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 - -# This script checks that all files have the appropriate copyright headers, -# according to their nearest .copywrite.hcl config file. The copyright tool -# does not natively support repos with multiple licenses, so we have to -# script this ourselves. - -set -euo pipefail - -# Find all directories containing a .copywrite.hcl config file -directories=$(find . -type f -name '.copywrite.hcl' -execdir pwd \;) - -for dir in $directories; do - cd $dir && go run github.com/hashicorp/copywrite headers -done \ No newline at end of file