Skip to content

Commit bd106a5

Browse files
committed
scaffold: fix spdx license header generation
1 parent 28dbce8 commit bd106a5

File tree

7 files changed

+33
-5
lines changed

7 files changed

+33
-5
lines changed

scaffold/templates/api/__groupVersion__/conversion.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/*
2+
{{- if .spdxLicenseHeaders }}
3+
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
4+
SPDX-License-Identifier: Apache-2.0
5+
{{- else }}
26
Copyright {{ now.Year }} {{ .owner }}.
37

48
Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
1216
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1317
See the License for the specific language governing permissions and
1418
limitations under the License.
19+
{{- end }}
1520
*/
1621

1722
package {{ .groupVersion }}

scaffold/templates/api/__groupVersion__/groupversion_info.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/*
2+
{{- if .spdxLicenseHeaders }}
3+
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
4+
SPDX-License-Identifier: Apache-2.0
5+
{{- else }}
26
Copyright {{ now.Year }} {{ .owner }}.
37

48
Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
1216
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1317
See the License for the specific language governing permissions and
1418
limitations under the License.
19+
{{- end }}
1520
*/
1621

1722
// +kubebuilder:object:generate=true

scaffold/templates/api/__groupVersion__/types.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/*
2+
{{- if .spdxLicenseHeaders }}
3+
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
4+
SPDX-License-Identifier: Apache-2.0
5+
{{- else }}
26
Copyright {{ now.Year }} {{ .owner }}.
37

48
Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
1216
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1317
See the License for the specific language governing permissions and
1418
limitations under the License.
19+
{{- end }}
1520
*/
1621

1722
package {{ .groupVersion }}

scaffold/templates/api/__groupVersion__/webhook.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{{- if or .validatingWebhookEnabled .mutatingWebhookEnabled -}}
22
/*
3+
{{- if .spdxLicenseHeaders }}
4+
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
5+
SPDX-License-Identifier: Apache-2.0
6+
{{- else }}
37
Copyright {{ now.Year }} {{ .owner }}.
48

59
Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +17,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
1317
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1418
See the License for the specific language governing permissions and
1519
limitations under the License.
20+
{{- end }}
1621
*/
1722

1823
package {{ .groupVersion }}

scaffold/templates/hack/boilerplate.go.txt.tpl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
{{- if .spdxLicenseHeaders -}}
21
/*
2+
{{- if .spdxLicenseHeaders }}
33
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
44
SPDX-License-Identifier: Apache-2.0
5-
*/
6-
{{ else -}}
7-
/*
5+
{{- else }}
86
Copyright {{ now.Year }} {{ .owner }}.
97

108
Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,5 +16,5 @@ distributed under the License is distributed on an "AS IS" BASIS,
1816
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1917
See the License for the specific language governing permissions and
2018
limitations under the License.
19+
{{- end }}
2120
*/
22-
{{ end -}}

scaffold/templates/main.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/*
2+
{{- if .spdxLicenseHeaders }}
3+
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
4+
SPDX-License-Identifier: Apache-2.0
5+
{{- else }}
26
Copyright {{ now.Year }} {{ .owner }}.
37

48
Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
1216
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1317
See the License for the specific language governing permissions and
1418
limitations under the License.
19+
{{- end }}
1520
*/
1621

1722
package main

scaffold/templates/pkg/operator/operator.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/*
2+
{{- if .spdxLicenseHeaders }}
3+
SPDX-FileCopyrightText: {{ now.Year }} {{ .owner }}
4+
SPDX-License-Identifier: Apache-2.0
5+
{{- else }}
26
Copyright {{ now.Year }} {{ .owner }}.
37

48
Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
1216
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1317
See the License for the specific language governing permissions and
1418
limitations under the License.
19+
{{- end }}
1520
*/
1621

1722
package operator

0 commit comments

Comments
 (0)