2828
2929// Init initializes a new app with name and given options.
3030// path is the relative path to the scaffoled app.
31- func (s * Scaffolder ) Init (tracer * placeholder.Tracer , name string ) (path string , err error ) {
31+ func (s * Scaffolder ) Init (tracer * placeholder.Tracer , name string , noDefaultModule bool ) (path string , err error ) {
3232 pathInfo , err := gomodulepath .Parse (name )
3333 if err != nil {
3434 return "" , err
@@ -40,7 +40,7 @@ func (s *Scaffolder) Init(tracer *placeholder.Tracer, name string) (path string,
4040 absRoot := filepath .Join (pwd , pathInfo .Root )
4141
4242 // create the project
43- if err := s .generate (tracer , pathInfo , absRoot ); err != nil {
43+ if err := s .generate (tracer , pathInfo , absRoot , noDefaultModule ); err != nil {
4444 return "" , err
4545 }
4646
@@ -56,7 +56,12 @@ func (s *Scaffolder) Init(tracer *placeholder.Tracer, name string) (path string,
5656}
5757
5858//nolint:interfacer
59- func (s * Scaffolder ) generate (tracer * placeholder.Tracer , pathInfo gomodulepath.Path , absRoot string ) error {
59+ func (s * Scaffolder ) generate (
60+ tracer * placeholder.Tracer ,
61+ pathInfo gomodulepath.Path ,
62+ absRoot string ,
63+ noDefaultModule bool ,
64+ ) error {
6065 g , err := app .New (& app.Options {
6166 // generate application template
6267 ModulePath : pathInfo .RawPath ,
@@ -79,23 +84,26 @@ func (s *Scaffolder) generate(tracer *placeholder.Tracer, pathInfo gomodulepath.
7984 }
8085
8186 // generate module template
82- opts := & modulecreate.CreateOptions {
83- ModuleName : pathInfo .Package , // App name
84- ModulePath : pathInfo .RawPath ,
85- AppName : pathInfo .Package ,
86- OwnerName : owner (pathInfo .RawPath ),
87- IsIBC : false ,
88- }
89- g , err = modulecreate .NewStargate (opts )
90- if err != nil {
91- return err
92- }
93- if err := run (genny .WetRunner (context .Background ()), g ); err != nil {
94- return err
95- }
96- g = modulecreate .NewStargateAppModify (tracer , opts )
97- if err := run (genny .WetRunner (context .Background ()), g ); err != nil {
98- return err
87+ if ! noDefaultModule {
88+ opts := & modulecreate.CreateOptions {
89+ ModuleName : pathInfo .Package , // App name
90+ ModulePath : pathInfo .RawPath ,
91+ AppName : pathInfo .Package ,
92+ OwnerName : owner (pathInfo .RawPath ),
93+ IsIBC : false ,
94+ }
95+ g , err = modulecreate .NewStargate (opts )
96+ if err != nil {
97+ return err
98+ }
99+ if err := run (genny .WetRunner (context .Background ()), g ); err != nil {
100+ return err
101+ }
102+ g = modulecreate .NewStargateAppModify (tracer , opts )
103+ if err := run (genny .WetRunner (context .Background ()), g ); err != nil {
104+ return err
105+ }
106+
99107 }
100108
101109 // generate the vue app.
0 commit comments