Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var task = &buildTask{

func NewTask(id int, build *Build, fn CallbackFn) error {
if exists := task.exists(id); exists {
return errors.New(fmt.Sprintf("build task [id: %d] have exists", id))
return fmt.Errorf("build task [id: %d] have exists", id)
}
task.append(id, build)
go func() {
Expand All @@ -45,7 +45,7 @@ func StopTask(id int) {
func StatusTask(id int) (*Result, []*command.TaskResult, error) {
build, exists := task.get(id)
if !exists {
return nil, nil, errors.New(fmt.Sprintf("build task [id: %d] not exists", id))
return nil, nil, fmt.Errorf("build task [id: %d] not exists", id)
}
return build.Result(), build.Output(), nil
}
Expand Down Expand Up @@ -83,4 +83,4 @@ func (t *buildTask) stop(id int) {
if exists {
build.Terminate()
}
}
}
4 changes: 2 additions & 2 deletions deploy/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var task = &deployTask{

func NewTask(id, mode int, deploys []*Deploy, startFn, finishFn CallbackFn, taskFn TaskCallbackFn) error {
if exists := task.exists(id); exists {
return errors.New(fmt.Sprintf("deploy task [id: %d] have exists", id))
return fmt.Errorf("deploy task [id: %d] have exists", id)
}
task.append(id, deploys)
go func() {
Expand Down Expand Up @@ -117,4 +117,4 @@ func (t *deployTask) stop(id int) {
deploy.Terminate()
}
}
}
}
6 changes: 3 additions & 3 deletions util/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func (c *Command) Run() error {
case <-time.After(c.Timeout):
err = c.terminate()
if err == nil {
err = errors.New(fmt.Sprintf("cmd run timeout, cmd [%s], time[%v]", c.Cmd, c.Timeout))
err = fmt.Errorf("cmd run timeout, cmd [%s], time[%v]", c.Cmd, c.Timeout)
}
case <-c.TerminateChan:
err = c.terminate()
if err == nil {
err = errors.New(fmt.Sprintf("cmd is terminated, cmd [%s]", c.Cmd))
err = fmt.Errorf("cmd is terminated, cmd [%s]", c.Cmd)
}
}
return err
Expand All @@ -88,4 +88,4 @@ func (c *Command) terminate() error {
} else {
return syscall.Kill(c.command.Process.Pid, syscall.SIGKILL)
}
}
}