From eaa73b87c6ce14341eff6d2bb2f518dda7bf2b3c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 17 Jun 2015 22:20:01 +0900 Subject: [PATCH] Style fixes --- command.go | 8 ++++---- config.go | 8 ++++---- link.go | 14 +++++++------- task.go | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/command.go b/command.go index 9fbb538..b626df5 100644 --- a/command.go +++ b/command.go @@ -32,18 +32,18 @@ import ( type command []string -func (this *command) process(dir string, flags int) error { - if len(*this) < 1 { +func (c *command) process(dir string, flags int) error { + if len(*c) < 1 { return fmt.Errorf("command element is invalid") } - cmd := exec.Command((*this)[0], (*this)[1:]...) + cmd := exec.Command((*c)[0], (*c)[1:]...) cmd.Dir = dir cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout if flags&flagVerbose == flagVerbose { - log.Printf("executing command %s", strings.Join(*this, " ")) + log.Printf("executing command %s", strings.Join(*c, " ")) } return cmd.Run() diff --git a/config.go b/config.go index 6ee383c..acd7386 100644 --- a/config.go +++ b/config.go @@ -29,13 +29,13 @@ type config struct { tasksHandled map[string]bool } -func (this *config) process(srcDir, dstDir, taskName string, flags int) error { - this.tasksHandled = make(map[string]bool) +func (c *config) process(srcDir, dstDir, taskName string, flags int) error { + c.tasksHandled = make(map[string]bool) - task, ok := this.Tasks[taskName] + task, ok := c.Tasks[taskName] if !ok { return fmt.Errorf("task not found %s", taskName) } - return task.process(taskName, srcDir, dstDir, this, flags) + return task.process(taskName, srcDir, dstDir, c, flags) } diff --git a/link.go b/link.go index c0ea54c..128e4d6 100644 --- a/link.go +++ b/link.go @@ -72,21 +72,21 @@ func createPath(loc string, flags int, mode os.FileMode) error { return nil } -func (this *link) parse() (string, string, os.FileMode, error) { - length := len(*this) +func (l *link) parse() (string, string, os.FileMode, error) { + length := len(*l) if length < 1 || length > 3 { return "", "", 0, fmt.Errorf("link element is invalid") } - dstPath := (*this)[0] + dstPath := (*l)[0] srcPath := dstPath if length > 1 { - srcPath = (*this)[1] + srcPath = (*l)[1] } var mode os.FileMode = 0755 if length > 2 { - parsed, err := strconv.ParseUint((*this)[2], 0, 64) + parsed, err := strconv.ParseUint((*l)[2], 0, 64) if err != nil { return "", "", 0, err } @@ -97,8 +97,8 @@ func (this *link) parse() (string, string, os.FileMode, error) { return srcPath, dstPath, mode, nil } -func (this *link) process(srcDir, dstDir string, flags int) error { - srcPath, dstPath, mode, err := this.parse() +func (l *link) process(srcDir, dstDir string, flags int) error { + srcPath, dstPath, mode, err := l.parse() if err != nil { return err } diff --git a/task.go b/task.go index ee6bb1d..5ab847f 100644 --- a/task.go +++ b/task.go @@ -30,7 +30,7 @@ type task struct { Cmds []command } -func (this *task) process(taskName, srcDir, dstDir string, conf *config, flags int) error { +func (t *task) process(taskName, srcDir, dstDir string, conf *config, flags int) error { handled, ok := conf.tasksHandled[taskName] if ok && handled { return nil @@ -38,7 +38,7 @@ func (this *task) process(taskName, srcDir, dstDir string, conf *config, flags i conf.tasksHandled[taskName] = true - for _, depName := range this.Deps { + for _, depName := range t.Deps { depTask, ok := conf.Tasks[depName] if !ok { return fmt.Errorf("task dependency not found %s", depName) @@ -50,7 +50,7 @@ func (this *task) process(taskName, srcDir, dstDir string, conf *config, flags i } if flags&flagNoLink == 0 { - for _, currLink := range this.Links { + for _, currLink := range t.Links { if err := currLink.process(srcDir, dstDir, flags); err != nil { return err } @@ -58,7 +58,7 @@ func (this *task) process(taskName, srcDir, dstDir string, conf *config, flags i } if flags&flagNoCmd == 0 { - for _, currCmd := range this.Cmds { + for _, currCmd := range t.Cmds { if err := currCmd.process(dstDir, flags); err != nil { return err }