File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,10 @@ func writeGitignore(trainingRootFs *afero.BasePathFs) error {
178178}
179179
180180func createGoWorkspace (trainingRoot string ) error {
181+ if ! hasGo () {
182+ return nil
183+ }
184+
181185 cmd := exec .Command ("go" , "work" , "init" )
182186 cmd .Dir = trainingRoot
183187
@@ -201,6 +205,10 @@ func hasGoWorkspace(trainingRoot string) bool {
201205}
202206
203207func addModuleToWorkspace (trainingRoot string , modulePath string ) error {
208+ if ! hasGo () {
209+ return nil
210+ }
211+
204212 if ! hasGoWorkspace (trainingRoot ) {
205213 return nil
206214 }
@@ -217,6 +225,11 @@ func addModuleToWorkspace(trainingRoot string, modulePath string) error {
217225 return nil
218226}
219227
228+ func hasGo () bool {
229+ _ , err := exec .LookPath ("go" )
230+ return err == nil
231+ }
232+
220233func (h * Handlers ) showTrainingStartPrompt (trainingDir string ) error {
221234 fmt .Printf (
222235 "This command will clone training source code to %s directory.\n " ,
You can’t perform that action at this time.
0 commit comments