-
Notifications
You must be signed in to change notification settings - Fork 18
🚸 Execute go mod tidy after basic creation
#123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a3f82fb
3f60284
432ef3a
66f65f0
941a87d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,7 +86,18 @@ | |
| return err | ||
| } | ||
|
|
||
| return runCmd(execCommand("go", "mod", "init", modName)) | ||
| if err := runCmd(execCommand("go", "mod", "init", modName)); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| //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 { | ||
|
Comment on lines
+94
to
+96
|
||
| return err | ||
| } | ||
|
Comment on lines
+94
to
+98
|
||
|
|
||
| return nil | ||
| } | ||
|
|
||
| const ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createBasicrunsgo mod initwithout settingCmd.Dir, but setsCmd.Dirforgo mod tidy. Since the function already receivesprojectPath, it would be more robust/consistent to setDirfor both commands (and avoid relying on a prioros.Chdir). This also preventsgo.modbeing created in the wrong directory ifcreateBasicis ever called withoutcreateProject.