Skip to content

Commit

Permalink
Create dep manifest file if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
font committed May 24, 2018
1 parent 123e075 commit f9688bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/kubebuilder/initproject/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func RunVendorInstall(cmd *cobra.Command, args []string) {
if !depExists() {
log.Fatalf("Dep is not installed. Follow steps at: https://golang.github.io/dep/docs/installation.html")
}
if Update {
if Update && depManifestExists() {
if err := updateDepManifest(); err != nil {
log.Fatalf("error upgrading the dep manifest (Gopkg.toml): %v", err)
}
Expand Down Expand Up @@ -85,6 +85,11 @@ func depExists() bool {
return err == nil
}

func depManifestExists() bool {
_, err := os.Stat(depManifestFile)
return os.IsExist(err)
}

func createNewDepManifest() {
depTmplArgs := map[string]string{
"Version": version.GetVersion().KubeBuilderVersion,
Expand Down

0 comments on commit f9688bb

Please sign in to comment.