diff --git a/genny/newapp/api/api.go b/genny/newapp/api/api.go index 2c7738050..b15501b5d 100644 --- a/genny/newapp/api/api.go +++ b/genny/newapp/api/api.go @@ -6,6 +6,7 @@ import ( "github.com/gobuffalo/buffalo/genny/newapp/core" "github.com/gobuffalo/genny" "github.com/gobuffalo/gogen" + "github.com/gobuffalo/gogen/gomods" "github.com/gobuffalo/packr/v2" ) @@ -33,5 +34,20 @@ func New(opts *Options) (*genny.Group, error) { gg.Add(g) + // DEP/MODS/go get should be last + if !opts.App.WithDep && !opts.App.WithModules { + g := genny.New() + g.Command(gogen.Get("./...", "-t")) + gg.Add(g) + } + + if opts.App.WithModules { + g, err := gomods.Tidy(opts.App.Root, false) + if err != nil { + return gg, err + } + gg.Add(g) + } + return gg, nil } diff --git a/genny/newapp/api/api_test.go b/genny/newapp/api/api_test.go index f8ed1070e..d975d7097 100644 --- a/genny/newapp/api/api_test.go +++ b/genny/newapp/api/api_test.go @@ -40,6 +40,7 @@ func Test_New(t *testing.T) { cmds := []string{"go get github.com/gobuffalo/buffalo-plugins", "go get -t ./...", + "go get -t ./...", } r.Len(res.Commands, len(cmds)) diff --git a/genny/newapp/web/web.go b/genny/newapp/web/web.go index 31a1abe26..25299121e 100644 --- a/genny/newapp/web/web.go +++ b/genny/newapp/web/web.go @@ -8,6 +8,7 @@ import ( "github.com/gobuffalo/buffalo/genny/newapp/core" "github.com/gobuffalo/genny" "github.com/gobuffalo/gogen" + "github.com/gobuffalo/gogen/gomods" "github.com/gobuffalo/packr/v2" ) @@ -54,5 +55,20 @@ func New(opts *Options) (*genny.Group, error) { gg.Add(g) } + // DEP/MODS/go get should be last + if !opts.App.WithDep && !opts.App.WithModules { + g := genny.New() + g.Command(gogen.Get("./...", "-t")) + gg.Add(g) + } + + if opts.App.WithModules { + g, err := gomods.Tidy(opts.App.Root, false) + if err != nil { + return gg, err + } + gg.Add(g) + } + return gg, nil } diff --git a/genny/newapp/web/web_test.go b/genny/newapp/web/web_test.go index 1f165e1e1..8dbdb562d 100644 --- a/genny/newapp/web/web_test.go +++ b/genny/newapp/web/web_test.go @@ -38,6 +38,7 @@ func Test_New(t *testing.T) { cmds := []string{"go get github.com/gobuffalo/buffalo-plugins", "go get -t ./...", + "go get -t ./...", } r.Len(res.Commands, len(cmds))