Skip to content

Commit

Permalink
🐛 fix copyright info when has not owner set
Browse files Browse the repository at this point in the history
  • Loading branch information
Camila Macedo committed Oct 28, 2020
1 parent aeed19b commit 5520582
Show file tree
Hide file tree
Showing 135 changed files with 300 additions and 149 deletions.
156 changes: 156 additions & 0 deletions 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# This is a combination of 2 commits.
# This is the 1st commit message:

:bug: fix copyright info when has not owner set

# This is the commit message #2:


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Wed Oct 28 09:36:12 2020 -0300
#
# interactive rebase in progress; onto 30d9998e
# Last commands done (3 commands done):
# pick 1cd4e651 :bug: fix copyright info when has not owner set
# squash be2f2bee dd
# No commands remaining.
# You are currently rebasing branch 'fix-1620' on '30d9998e'.
#
# Changes to be committed:
# modified: pkg/plugin/v2/scaffolds/internal/templates/boilerplate.go
# modified: pkg/plugin/v3/scaffolds/internal/templates/config/hack/boilerplate.go
# modified: testdata/project-v2-addon/api/v1/admiral_types.go
# modified: testdata/project-v2-addon/api/v1/captain_types.go
# modified: testdata/project-v2-addon/api/v1/firstmate_types.go
# modified: testdata/project-v2-addon/api/v1/groupversion_info.go
# modified: testdata/project-v2-addon/api/v1/zz_generated.deepcopy.go
# modified: testdata/project-v2-addon/controllers/admiral_controller.go
# modified: testdata/project-v2-addon/controllers/captain_controller.go
# modified: testdata/project-v2-addon/controllers/firstmate_controller.go
# modified: testdata/project-v2-addon/controllers/suite_test.go
# modified: testdata/project-v2-addon/hack/boilerplate.go.txt
# modified: testdata/project-v2-addon/main.go
# modified: testdata/project-v2-multigroup/apis/crew/v1/captain_types.go
# modified: testdata/project-v2-multigroup/apis/crew/v1/captain_webhook.go
# modified: testdata/project-v2-multigroup/apis/crew/v1/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/crew/v1/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/apis/foo.policy/v1/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/foo.policy/v1/healthcheckpolicy_types.go
# modified: testdata/project-v2-multigroup/apis/foo.policy/v1/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/apis/sea-creatures/v1beta1/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/sea-creatures/v1beta1/kraken_types.go
# modified: testdata/project-v2-multigroup/apis/sea-creatures/v1beta1/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/apis/sea-creatures/v1beta2/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/sea-creatures/v1beta2/leviathan_types.go
# modified: testdata/project-v2-multigroup/apis/sea-creatures/v1beta2/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/apis/ship/v1/destroyer_types.go
# modified: testdata/project-v2-multigroup/apis/ship/v1/destroyer_webhook.go
# modified: testdata/project-v2-multigroup/apis/ship/v1/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/ship/v1/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/apis/ship/v1beta1/frigate_types.go
# modified: testdata/project-v2-multigroup/apis/ship/v1beta1/frigate_webhook.go
# modified: testdata/project-v2-multigroup/apis/ship/v1beta1/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/ship/v1beta1/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/apis/ship/v2alpha1/cruiser_types.go
# modified: testdata/project-v2-multigroup/apis/ship/v2alpha1/cruiser_webhook.go
# modified: testdata/project-v2-multigroup/apis/ship/v2alpha1/groupversion_info.go
# modified: testdata/project-v2-multigroup/apis/ship/v2alpha1/zz_generated.deepcopy.go
# modified: testdata/project-v2-multigroup/controllers/crew/captain_controller.go
# modified: testdata/project-v2-multigroup/controllers/crew/suite_test.go
# modified: testdata/project-v2-multigroup/controllers/foo.policy/healthcheckpolicy_controller.go
# modified: testdata/project-v2-multigroup/controllers/foo.policy/suite_test.go
# modified: testdata/project-v2-multigroup/controllers/sea-creatures/kraken_controller.go
# modified: testdata/project-v2-multigroup/controllers/sea-creatures/leviathan_controller.go
# modified: testdata/project-v2-multigroup/controllers/sea-creatures/suite_test.go
# modified: testdata/project-v2-multigroup/controllers/ship/cruiser_controller.go
# modified: testdata/project-v2-multigroup/controllers/ship/destroyer_controller.go
# modified: testdata/project-v2-multigroup/controllers/ship/frigate_controller.go
# modified: testdata/project-v2-multigroup/controllers/ship/suite_test.go
# modified: testdata/project-v2-multigroup/hack/boilerplate.go.txt
# modified: testdata/project-v2-multigroup/main.go
# modified: testdata/project-v2/api/v1/admiral_types.go
# modified: testdata/project-v2/api/v1/admiral_webhook.go
# modified: testdata/project-v2/api/v1/captain_types.go
# modified: testdata/project-v2/api/v1/captain_webhook.go
# modified: testdata/project-v2/api/v1/firstmate_types.go
# modified: testdata/project-v2/api/v1/firstmate_webhook.go
# modified: testdata/project-v2/api/v1/groupversion_info.go
# modified: testdata/project-v2/api/v1/zz_generated.deepcopy.go
# modified: testdata/project-v2/controllers/admiral_controller.go
# modified: testdata/project-v2/controllers/captain_controller.go
# modified: testdata/project-v2/controllers/firstmate_controller.go
# modified: testdata/project-v2/controllers/suite_test.go
# modified: testdata/project-v2/hack/boilerplate.go.txt
# modified: testdata/project-v2/main.go
# modified: testdata/project-v3-addon/api/v1/admiral_types.go
# modified: testdata/project-v3-addon/api/v1/captain_types.go
# modified: testdata/project-v3-addon/api/v1/firstmate_types.go
# modified: testdata/project-v3-addon/api/v1/groupversion_info.go
# modified: testdata/project-v3-addon/api/v1/zz_generated.deepcopy.go
# modified: testdata/project-v3-addon/controllers/admiral_controller.go
# modified: testdata/project-v3-addon/controllers/captain_controller.go
# modified: testdata/project-v3-addon/controllers/firstmate_controller.go
# modified: testdata/project-v3-addon/controllers/suite_test.go
# modified: testdata/project-v3-addon/hack/boilerplate.go.txt
# modified: testdata/project-v3-addon/main.go
# modified: testdata/project-v3-multigroup/apis/crew/v1/captain_types.go
# modified: testdata/project-v3-multigroup/apis/crew/v1/captain_webhook.go
# modified: testdata/project-v3-multigroup/apis/crew/v1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/crew/v1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/foo.policy/v1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/foo.policy/v1/healthcheckpolicy_types.go
# modified: testdata/project-v3-multigroup/apis/foo.policy/v1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/sea-creatures/v1beta1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/sea-creatures/v1beta1/kraken_types.go
# modified: testdata/project-v3-multigroup/apis/sea-creatures/v1beta1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/sea-creatures/v1beta2/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/sea-creatures/v1beta2/leviathan_types.go
# modified: testdata/project-v3-multigroup/apis/sea-creatures/v1beta2/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/ship/v1/destroyer_types.go
# modified: testdata/project-v3-multigroup/apis/ship/v1/destroyer_webhook.go
# modified: testdata/project-v3-multigroup/apis/ship/v1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/ship/v1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/ship/v1beta1/frigate_types.go
# modified: testdata/project-v3-multigroup/apis/ship/v1beta1/frigate_webhook.go
# modified: testdata/project-v3-multigroup/apis/ship/v1beta1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/ship/v1beta1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/ship/v2alpha1/cruiser_types.go
# modified: testdata/project-v3-multigroup/apis/ship/v2alpha1/cruiser_webhook.go
# modified: testdata/project-v3-multigroup/apis/ship/v2alpha1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/ship/v2alpha1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/apis/v1/groupversion_info.go
# modified: testdata/project-v3-multigroup/apis/v1/lakers_types.go
# modified: testdata/project-v3-multigroup/apis/v1/lakers_webhook.go
# modified: testdata/project-v3-multigroup/apis/v1/zz_generated.deepcopy.go
# modified: testdata/project-v3-multigroup/controllers/crew/captain_controller.go
# modified: testdata/project-v3-multigroup/controllers/crew/suite_test.go
# modified: testdata/project-v3-multigroup/controllers/foo.policy/healthcheckpolicy_controller.go
# modified: testdata/project-v3-multigroup/controllers/foo.policy/suite_test.go
# modified: testdata/project-v3-multigroup/controllers/lakers_controller.go
# modified: testdata/project-v3-multigroup/controllers/sea-creatures/kraken_controller.go
# modified: testdata/project-v3-multigroup/controllers/sea-creatures/leviathan_controller.go
# modified: testdata/project-v3-multigroup/controllers/sea-creatures/suite_test.go
# modified: testdata/project-v3-multigroup/controllers/ship/cruiser_controller.go
# modified: testdata/project-v3-multigroup/controllers/ship/destroyer_controller.go
# modified: testdata/project-v3-multigroup/controllers/ship/frigate_controller.go
# modified: testdata/project-v3-multigroup/controllers/ship/suite_test.go
# modified: testdata/project-v3-multigroup/controllers/suite_test.go
# modified: testdata/project-v3-multigroup/hack/boilerplate.go.txt
# modified: testdata/project-v3-multigroup/main.go
# modified: testdata/project-v3/api/v1/admiral_types.go
# modified: testdata/project-v3/api/v1/admiral_webhook.go
# modified: testdata/project-v3/api/v1/captain_types.go
# modified: testdata/project-v3/api/v1/captain_webhook.go
# modified: testdata/project-v3/api/v1/firstmate_types.go
# modified: testdata/project-v3/api/v1/firstmate_webhook.go
# modified: testdata/project-v3/api/v1/groupversion_info.go
# modified: testdata/project-v3/api/v1/zz_generated.deepcopy.go
# modified: testdata/project-v3/controllers/admiral_controller.go
# modified: testdata/project-v3/controllers/captain_controller.go
# modified: testdata/project-v3/controllers/firstmate_controller.go
# modified: testdata/project-v3/controllers/suite_test.go
# modified: testdata/project-v3/hack/boilerplate.go.txt
# modified: testdata/project-v3/main.go
#
4 changes: 4 additions & 0 deletions pkg/plugin/v2/scaffolds/internal/templates/boilerplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func (f *Boilerplate) SetTemplateDefaults() error {
const apache = `/*
{{ if .Owner -}}
Copyright {{ .Year }} {{ .Owner }}.
{{ else }}
Copyright {{ .Year }}.
{{- end }}
Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -89,5 +91,7 @@ limitations under the License.
const none = `/*
{{ if .Owner -}}
Copyright {{ .Year }} {{ .Owner }}.
{{ else }}
Copyright {{ .Year }}.
{{- end }}
*/`
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type Boilerplate struct {
// Owner is the copyright owner - e.g. "The Kubernetes Authors"
Owner string

// Year is the copyright year
Year string
// Copyright is data add in the License header
Copyright string
}

// SetTemplateDefaults implements input.Template
Expand All @@ -47,8 +47,10 @@ func (f *Boilerplate) SetTemplateDefaults() error {
f.Path = filepath.Join("hack", "boilerplate.go.txt")
}

if f.Year == "" {
f.Year = fmt.Sprintf("%v", time.Now().Year())
if f.Owner != "" {
f.Copyright = fmt.Sprintf("Copyright %v %v", time.Now().Year(), f.Owner)
} else {
f.Copyright = fmt.Sprintf("Copyright %v", time.Now().Year())
}

// Boilerplate given
Expand All @@ -69,10 +71,7 @@ func (f *Boilerplate) SetTemplateDefaults() error {
}

const apache = `/*
{{ if .Owner -}}
Copyright {{ .Year }} {{ .Owner }}.
{{- end }}
{{ .Copyright }}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -87,7 +86,5 @@ limitations under the License.
*/`

const none = `/*
{{ if .Owner -}}
Copyright {{ .Year }} {{ .Owner }}.
{{- end }}
{{ .Copyright }}
*/`
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/admiral_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/captain_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/firstmate_types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/controllers/suite_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/hack/boilerplate.go.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
1 change: 1 addition & 0 deletions testdata/project-v2-addon/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2020 The Kubernetes authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down

0 comments on commit 5520582

Please sign in to comment.