Skip to content

Commit

Permalink
fix: run go mod tidy after create domain
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidayat Hamir committed Feb 6, 2024
1 parent f218308 commit cc217e5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go install github.com/spacetronot-research-team/erago@latest
or you can define your prefered version.

```shell
go install github.com/spacetronot-research-team/erago@v0.0.5
go install github.com/spacetronot-research-team/erago@v0.0.6
```

Or you can download erago binary from release page.
Expand Down
19 changes: 19 additions & 0 deletions cmd/createdomain/create_domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func CreateDomain(domain string) {
log.Fatal(err)
}

log.Println("run go mod tidy")
if err := runGoModTidy(); err != nil {
log.Fatal(fmt.Errorf("err run go mod tidy: %v", err))
}

log.Println("create domain finish")
}

Expand Down Expand Up @@ -165,3 +170,17 @@ func generateRepositoryTemplate(domain string) error {

return nil
}

func runGoModTidy() error {
cmd := exec.Command("go", "mod", "tidy")
stdout, err := cmd.Output()
if err != nil {
return err
}

if string(stdout) != "" {
fmt.Println(string(stdout))
}

return nil
}
19 changes: 0 additions & 19 deletions cmd/createproject/create_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ func CreateProject(projectName string, moduleName string) {
log.Println("create domain hello world")
createdomain.CreateDomain("hello world")

log.Println("run go mod tidy")
if err := runGoModTidy(); err != nil {
log.Fatal(fmt.Errorf("err run go mod tidy in projectPath: %v", err))
}

log.Println("create project finish, go to your project:\n\tcd", projectPath)
}

Expand All @@ -80,17 +75,3 @@ func runGoModInit(moduleName string, projectPath string) error {

return nil
}

func runGoModTidy() error {
cmd := exec.Command("go", "mod", "tidy")
stdout, err := cmd.Output()
if err != nil {
return err
}

if string(stdout) != "" {
fmt.Println(string(stdout))
}

return nil
}
2 changes: 1 addition & 1 deletion cmd/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package version
import "fmt"

func Version() {
fmt.Println("v0.0.5")
fmt.Println("v0.0.6")
}

0 comments on commit cc217e5

Please sign in to comment.