Skip to content

Commit

Permalink
Fix issue where creation commands didn't find the boilerplate.go.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
pwittrock committed Mar 21, 2018
1 parent f6921db commit ce7c0e1
Show file tree
Hide file tree
Showing 4 changed files with 5 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

0 comments on commit ce7c0e1

Please sign in to comment.