Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/kubebuilder-gen/codegen/run/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func generatorToPackage(pkg string, gen generator.Generator) generator.Package {

// generatedGoHeader returns the header to preprend to generated go files
func generatedGoHeader() []byte {
cr, err := ioutil.ReadFile("boilerplate.go.txt")
cr, err := ioutil.ReadFile(filepath.Join("hack", "boilerplate.go.txt"))
if err != nil {
return []byte{}
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/kubebuilder/create/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/spf13/cobra"

"github.com/kubernetes-sigs/kubebuilder/cmd/kubebuilder/util"
"path/filepath"
)

var (
Expand Down Expand Up @@ -71,5 +72,5 @@ func RegisterResourceFlags(cmd *cobra.Command) {
}

func RegisterCopyrightFlag(cmd *cobra.Command) {
cmd.Flags().StringVar(&Copyright, "copyright", "boilerplate.go.txt", "Location of copyright boilerplate file.")
cmd.Flags().StringVar(&Copyright, "copyright", filepath.Join("hack", "boilerplate.go.txt"), "Location of copyright boilerplate file.")
}
2 changes: 1 addition & 1 deletion cmd/kubebuilder/initproject/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var bazel bool
func AddInit(cmd *cobra.Command) {
cmd.AddCommand(repoCmd)
repoCmd.Flags().StringVar(&domain, "domain", "", "domain for the API groups")
repoCmd.Flags().StringVar(&copyright, "copyright", "boilerplate.go.txt", "Location of copyright boilerplate file.")
repoCmd.Flags().StringVar(&copyright, "copyright", filepath.Join("hack", "boilerplate.go.txt"), "Location of copyright boilerplate file.")
repoCmd.Flags().BoolVar(&bazel, "bazel", false, "if true, setup Bazel workspace artifacts")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/kubebuilder/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func WriteString(path, value string) {
// if the file cannot be read, will return the empty string.
func GetCopyright(file string) string {
if len(file) == 0 {
file = "boilerplate.go.txt"
file = filepath.Join("hack", "boilerplate.go.txt")
}
cr, err := ioutil.ReadFile(file)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions samples/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func NewController(iargs args.InjectArgs) *controller.GenericController {
samplescheme.AddToScheme(scheme.Scheme)

c := &Controller{
InjectArgs: iargs,
recorder: iargs.CreateRecorder(controllerAgentName),
}

Expand Down