mirror of https://github.com/hashicorp/terraform
We have a few directories in this repo that will be remaining MPL licensed (the provider protocol definitions). This is something that the copywrite tool does not support out of the box - we need to run the tool for each directory that contains a .copywrite.hcl file in order to make sure that new files have the correct header. To avoid adding yet more boilerplate with a `copyright_headers.go` file in each package, let's move the copyright check to its own make target and script the process of discovering all directories with copywrite config.pull/33702/head
parent
400f6ee3f0
commit
2a5ff48e3d
@ -1,13 +0,0 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
|
||||
//go:build tools
|
||||
// +build tools
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "github.com/hashicorp/copywrite"
|
||||
)
|
||||
|
||||
//go:generate go run github.com/hashicorp/copywrite headers
|
||||
@ -0,0 +1,17 @@
|
||||
#!/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
|
||||
Loading…
Reference in new issue