diff --git a/Makefile b/Makefile index 45cbd3b8..bdc5bf1f 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/hack/add_license_headers.sh b/hack/add_license_headers.sh index 8cac9e79..5f65c652 100755 --- a/hack/add_license_headers.sh +++ b/hack/add_license_headers.sh @@ -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 -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 \ diff --git a/hack/license_boilerplate.txt b/hack/license_boilerplate.txt index 9266b594..f5515f9d 100644 --- a/hack/license_boilerplate.txt +++ b/hack/license_boilerplate.txt @@ -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 \ No newline at end of file