refactoring

This commit is contained in:
alessio 2017-08-27 11:23:55 +02:00
parent 648fccf000
commit 560d58dfa0

View File

@ -24,9 +24,8 @@ func (h *Blueprint) Run(p *cli.Context) error {
if p.String("name") != "" && h.Projects[k].Name != p.String("name") {
continue
}
tools := tools{}
if element.Cmds.Fmt {
tools.Fmt = tool{
h.Projects[k].tools.Fmt = tool{
status: &h.Projects[k].Cmds.Fmt,
cmd: "gofmt",
options: []string{"-s", "-w", "-e"},
@ -34,7 +33,7 @@ func (h *Blueprint) Run(p *cli.Context) error {
}
}
if element.Cmds.Generate {
tools.Generate = tool{
h.Projects[k].tools.Generate = tool{
status: &h.Projects[k].Cmds.Generate,
cmd: "go",
options: []string{"generate"},
@ -42,7 +41,7 @@ func (h *Blueprint) Run(p *cli.Context) error {
}
}
if element.Cmds.Test {
tools.Test = tool{
h.Projects[k].tools.Test = tool{
status: &h.Projects[k].Cmds.Test,
cmd: "go",
options: []string{"test"},
@ -50,14 +49,13 @@ func (h *Blueprint) Run(p *cli.Context) error {
}
}
if element.Cmds.Vet {
tools.Vet = tool{
h.Projects[k].tools.Vet = tool{
status: &h.Projects[k].Cmds.Vet,
cmd: "go",
options: []string{"vet"},
name: "Go Vet",
}
}
h.Projects[k].tools = tools
h.Projects[k].parent = h
h.Projects[k].path = h.Projects[k].Path
@ -131,7 +129,7 @@ func (h *Blueprint) Remove(p *cli.Context) error {
return nil
}
}
return errors.New("no project found")
return errors.New("No project found.")
}
// List of all the projects
@ -193,5 +191,5 @@ func (h *Blueprint) check() error {
h.Clean()
return nil
}
return errors.New("There are no projects")
return errors.New("There are no projects.")
}