Skip to content

Commit

Permalink
feat: Exec go mod tidy after basic creation
Browse files Browse the repository at this point in the history
  • Loading branch information
valentimarco committed Dec 5, 2024
1 parent f345bf8 commit a3f82fb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,18 @@ func createBasic(projectPath, modName string) (err error) {
return
}

return runCmd(execCommand("go", "mod", "init", modName))
if err = runCmd(execCommand("go", "mod", "init", modName)); err != nil{
return
}

//Execute go mod tidy in the project directory
installModules := execCommand("go", "mod", "tidy")
installModules.Dir = fmt.Sprintf("%s%c", projectPath, os.PathSeparator)
if err = runCmd(installModules); err != nil{
return
}

return
}

const githubPrefix = "https://github.com/"
Expand Down

0 comments on commit a3f82fb

Please sign in to comment.