From 560d58dfa0c69960dbe2fb29b75c41924ae401f0 Mon Sep 17 00:00:00 2001 From: alessio Date: Sun, 27 Aug 2017 11:23:55 +0200 Subject: [PATCH] refactoring --- watcher/cmd.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/watcher/cmd.go b/watcher/cmd.go index 7052e40..978a614 100644 --- a/watcher/cmd.go +++ b/watcher/cmd.go @@ -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.") }