Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
Check for dep and goimports before go getting. (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaunn Barron authored and markbates committed Mar 20, 2018
1 parent 040c28b commit d4b620c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions generators/newapp/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ func (a Generator) Run(root string, data makr.Data) error {
os.RemoveAll(a.Root)
}

g.Add(makr.NewCommand(makr.GoGet("golang.org/x/tools/cmd/goimports", "-u")))
if _, err := exec.LookPath("goimports"); err != nil {
g.Add(makr.NewCommand(makr.GoGet("golang.org/x/tools/cmd/goimports", "-u")))
}

if a.WithDep {
g.Add(makr.NewCommand(makr.GoGet("github.com/golang/dep/cmd/dep", "-u")))
if _, err := exec.LookPath("dep"); err != nil {
g.Add(makr.NewCommand(makr.GoGet("github.com/golang/dep/cmd/dep", "-u")))
}
}

files, err := generators.FindByBox(packr.NewBox("../newapp/templates"))
Expand Down

0 comments on commit d4b620c

Please sign in to comment.