@@ -38,16 +38,13 @@ func initialize(name string, arch string, oso string) {
3838 project .Arch = arch
3939 project .OS = oso
4040 project .Vars = append (project .Vars , models.Var {"" , "" })
41- var commands models.Commands
4241 var command models.Command
4342 command .Name = "run"
4443 command .Path = path
4544 command .Option = "mod"
46- commands .Commands = append (commands .Commands , command )
45+ project .Commands = append (project .Commands , command )
4746 file , _ := json .MarshalIndent (project , "" , " " )
4847 _ = ioutil .WriteFile ("project.json" , file , 0644 )
49- file , _ = json .MarshalIndent (commands , "" , " " )
50- _ = ioutil .WriteFile ("godemon-cnf.json" , file , 0644 )
5148 cmd := exec .Command ("go" , "mod" , "init" , name )
5249 cmd .Stdout = os .Stdout
5350 cmd .Stderr = os .Stderr
@@ -56,17 +53,17 @@ func initialize(name string, arch string, oso string) {
5653}
5754
5855func cnfFunc (command string , filepath string , modOrFile string ) (string , string ) {
59- jsonFile , err := os .Open ("godemon-cnf .json" )
56+ jsonFile , err := os .Open ("project .json" )
6057 ErrorHandle (err )
6158 defer jsonFile .Close ()
6259 byteValue , err := ioutil .ReadAll (jsonFile )
6360 ErrorHandle (err )
64- var commands models.Commands
65- json .Unmarshal (byteValue , & commands )
66- for i := 0 ; i < len (commands .Commands ); i ++ {
67- if command == commands .Commands [i ].Name {
68- filepath = commands .Commands [i ].Path
69- modOrFile = commands .Commands [i ].Option
61+ var project models.Project
62+ json .Unmarshal (byteValue , & project )
63+ for i := 0 ; i < len (project .Commands ); i ++ {
64+ if command == project .Commands [i ].Name {
65+ filepath = project .Commands [i ].Path
66+ modOrFile = project .Commands [i ].Option
7067 }
7168 }
7269 return filepath , modOrFile
0 commit comments