1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Remove ignore_errors

This commit is contained in:
Stephen Prater
2019-05-28 13:02:59 -07:00
parent 659cae6a4c
commit 044d3a0ff9
7 changed files with 39 additions and 95 deletions

View File

@@ -12,9 +12,8 @@ var (
// Precondition represents a precondition necessary for a task to run
type Precondition struct {
Sh string
Msg string
IgnoreError bool
Sh string
Msg string
}
// UnmarshalYAML implements yaml.Unmarshaler interface.
@@ -24,28 +23,23 @@ func (p *Precondition) UnmarshalYAML(unmarshal func(interface{}) error) error {
if err := unmarshal(&cmd); err == nil {
p.Sh = cmd
p.Msg = fmt.Sprintf("`%s` failed", cmd)
p.IgnoreError = false
return nil
}
var sh struct {
Sh string
Msg string
IgnoreError bool `yaml:"ignore_error"`
Sh string
Msg string
}
err := unmarshal(&sh)
if err == nil {
p.Sh = sh.Sh
p.Msg = sh.Msg
if p.Msg == "" {
p.Msg = fmt.Sprintf("%s failed", sh.Sh)
}
p.IgnoreError = sh.IgnoreError
return nil
if err := unmarshal(&sh); err != nil {
return err
}
return err
p.Sh = sh.Sh
p.Msg = sh.Msg
if p.Msg == "" {
p.Msg = fmt.Sprintf("%s failed", sh.Sh)
}
return nil
}