Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#18 from pwittrock/fixes
Browse files Browse the repository at this point in the history
Fix minor issues in finding boilerplate and sample
  • Loading branch information
Phillip Wittrock committed Mar 21, 2018
2 parents 2794177 + 21ce3b5 commit 4b02bf2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
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

0 comments on commit 4b02bf2

Please sign in to comment.