Skip to content

Commit

Permalink
Minor change in generating license headers (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-s-rao authored Mar 21, 2024
1 parent 3e874cb commit 9040608
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include hack/tools.mk

.PHONY: add-license-headers
add-license-headers: $(GO_ADD_LICENSE)
@./hack/add_license_headers.sh ${YEAR}
@./hack/add_license_headers.sh

.PHONY: build
build:
Expand Down
11 changes: 2 additions & 9 deletions hack/add_license_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@ set -e

echo "> Adding Apache License header to all go files where it is not present"

YEAR=$1
if [[ -z "$1" ]]; then
cat << EOF
Unspecified 'YEAR' argument.
Usage: add_licence_headers.sh <YEAR>
EOF
exit 1
fi
YEAR="$(date +%Y)"

temp_file=$(mktemp)
trap "rm -f $temp_file" EXIT
sed "s/{YEAR}/${YEAR}/g" hack/license_boilerplate.txt > $temp_file
sed "s/YEAR/${YEAR}/g" hack/license_boilerplate.txt > $temp_file

# Uses the tool https://github.com/google/addlicense
addlicense \
Expand Down
2 changes: 1 addition & 1 deletion hack/license_boilerplate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SPDX-FileCopyrightText: {YEAR} SAP SE or an SAP affiliate company and Gardener contributors
SPDX-FileCopyrightText: YEAR SAP SE or an SAP affiliate company and Gardener contributors

SPDX-License-Identifier: Apache-2.0

0 comments on commit 9040608

Please sign in to comment.