Skip to content

Commit 4b02bf2

Browse files
author
Phillip Wittrock
authored
Merge pull request #18 from pwittrock/fixes
Fix minor issues in finding boilerplate and sample
2 parents 2794177 + 21ce3b5 commit 4b02bf2

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

cmd/kubebuilder-gen/codegen/run/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func generatorToPackage(pkg string, gen generator.Generator) generator.Package {
4444

4545
// generatedGoHeader returns the header to preprend to generated go files
4646
func generatedGoHeader() []byte {
47-
cr, err := ioutil.ReadFile("boilerplate.go.txt")
47+
cr, err := ioutil.ReadFile(filepath.Join("hack", "boilerplate.go.txt"))
4848
if err != nil {
4949
return []byte{}
5050
}

cmd/kubebuilder/create/util/util.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/spf13/cobra"
2626

2727
"github.com/kubernetes-sigs/kubebuilder/cmd/kubebuilder/util"
28+
"path/filepath"
2829
)
2930

3031
var (
@@ -71,5 +72,5 @@ func RegisterResourceFlags(cmd *cobra.Command) {
7172
}
7273

7374
func RegisterCopyrightFlag(cmd *cobra.Command) {
74-
cmd.Flags().StringVar(&Copyright, "copyright", "boilerplate.go.txt", "Location of copyright boilerplate file.")
75+
cmd.Flags().StringVar(&Copyright, "copyright", filepath.Join("hack", "boilerplate.go.txt"), "Location of copyright boilerplate file.")
7576
}

cmd/kubebuilder/initproject/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var bazel bool
4343
func AddInit(cmd *cobra.Command) {
4444
cmd.AddCommand(repoCmd)
4545
repoCmd.Flags().StringVar(&domain, "domain", "", "domain for the API groups")
46-
repoCmd.Flags().StringVar(&copyright, "copyright", "boilerplate.go.txt", "Location of copyright boilerplate file.")
46+
repoCmd.Flags().StringVar(&copyright, "copyright", filepath.Join("hack", "boilerplate.go.txt"), "Location of copyright boilerplate file.")
4747
repoCmd.Flags().BoolVar(&bazel, "bazel", false, "if true, setup Bazel workspace artifacts")
4848
}
4949

cmd/kubebuilder/util/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func WriteString(path, value string) {
9797
// if the file cannot be read, will return the empty string.
9898
func GetCopyright(file string) string {
9999
if len(file) == 0 {
100-
file = "boilerplate.go.txt"
100+
file = filepath.Join("hack", "boilerplate.go.txt")
101101
}
102102
cr, err := ioutil.ReadFile(file)
103103
if err != nil {

samples/controller/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ func NewController(iargs args.InjectArgs) *controller.GenericController {
6969
samplescheme.AddToScheme(scheme.Scheme)
7070

7171
c := &Controller{
72+
InjectArgs: iargs,
7273
recorder: iargs.CreateRecorder(controllerAgentName),
7374
}
7475

0 commit comments

Comments
 (0)