Skip to content

Commit 61742f4

Browse files
author
Phillip Wittrock
authored
Merge pull request #211 from font/depmanifest
Create dep manifest file if it doesn't exist
2 parents 39c079e + f9688bb commit 61742f4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/kubebuilder/initproject/vendor.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func RunVendorInstall(cmd *cobra.Command, args []string) {
5555
if !depExists() {
5656
log.Fatalf("Dep is not installed. Follow steps at: https://golang.github.io/dep/docs/installation.html")
5757
}
58-
if Update {
58+
if Update && depManifestExists() {
5959
if err := updateDepManifest(); err != nil {
6060
log.Fatalf("error upgrading the dep manifest (Gopkg.toml): %v", err)
6161
}
@@ -85,6 +85,11 @@ func depExists() bool {
8585
return err == nil
8686
}
8787

88+
func depManifestExists() bool {
89+
_, err := os.Stat(depManifestFile)
90+
return os.IsExist(err)
91+
}
92+
8893
func createNewDepManifest() {
8994
depTmplArgs := map[string]string{
9095
"Version": version.GetVersion().KubeBuilderVersion,

0 commit comments

Comments
 (0)