From 69420a9ffa803f0f0990be1fb8ea9ec69fd5fb69 Mon Sep 17 00:00:00 2001 From: jharshman Date: Tue, 29 Jan 2019 19:11:26 -0800 Subject: [PATCH] vgo - create directory --- cobra/cmd/init.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cobra/cmd/init.go b/cobra/cmd/init.go index 02e303f7..c334121a 100644 --- a/cobra/cmd/init.go +++ b/cobra/cmd/init.go @@ -74,6 +74,9 @@ Init will not use an existing directory with contents.`, } // create cmd/root.go + if _, err = os.Stat(fmt.Sprintf("%s/cmd", project.AbsolutePath)); os.IsNotExist(err) { + os.Mkdir("cmd", 0751) + } rootFile, err := os.Create(fmt.Sprintf("%s/cmd/root.go", project.AbsolutePath)) if err != nil { er(err)