diff --git a/cmd/kubebuilder/initproject/vendor.go b/cmd/kubebuilder/initproject/vendor.go index 9ea0e95c9e..c4ec627226 100644 --- a/cmd/kubebuilder/initproject/vendor.go +++ b/cmd/kubebuilder/initproject/vendor.go @@ -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) } @@ -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,