func (r *Run) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var cl CommandList
	commandCandidate := marshal.UnmarshalCandidate{
		Unmarshal: func() error { return unmarshal(&cl) },
		Assign:    func() { *r = Run{Command: cl} },
	}

	type runType Run // Use new type to avoid recursion
	var runItem runType
	runCandidate := marshal.UnmarshalCandidate{
		Unmarshal: func() error { return unmarshal(&runItem) },
		Assign:    func() { *r = Run(runItem) },
		Validate: func() error {
			actionUsedList := []bool{
				len(runItem.Command) != 0,
				len(runItem.SubTaskList) != 0,
				runItem.SetEnvironment != nil,
			}

			count := 0
			for _, isUsed := range actionUsedList {
				if isUsed {
					count++
				}
			}

			if count > 1 {
				return errors.New("only one action can be defined in `run`")
			}

			return nil
		},
	}

	return marshal.UnmarshalOneOf(commandCandidate, runCandidate)
}
// UnmarshalYAML allows simple commands to represent run structs.
UnmarshalYAML allows simple commands to represent run structs.
// UnmarshalYAML allows simple commands to represent run structs .
func (r *Run) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var cl CommandList
	commandCandidate := marshal.UnmarshalCandidate{
		Unmarshal: func() error { return unmarshal(&cl) },
		Assign:    func() { *r = Run{Command: cl} },
	}
	type runType Run 
	var runItem runType
	runCandidate := marshal.UnmarshalCandidate{
		Unmarshal: func() error { return unmarshal(&runItem) },
		Assign:    func() { *r = Run(runItem) },
		Validate: func() error {
			actionUsedList := []bool{
				len(runItem.Command) != 0,
				len(runItem.SubTaskList) != 0,
				runItem.SetEnvironment != nil,
			}
			count := 0
			for _, isUsed := range actionUsedList {
				if isUsed {
					count++
				}
			}
			if count > 1 {
				return errors.New("only one action can be defined in `run`")
			}
			return nil
		},
	}
	return marshal.UnmarshalOneOf(commandCandidate, runCandidate)
}
func ( r * Run ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error { var cl CommandList commandCandidate := marshal . UnmarshalCandidate { Unmarshal : func ( ) error { return unmarshal ( & cl ) } , Assign : func ( ) { * r = Run { Command : cl } } , } type runType Run var runItem runType runCandidate := marshal . UnmarshalCandidate { Unmarshal : func ( ) error { return unmarshal ( & runItem ) } , Assign : func ( ) { * r = Run ( runItem ) } , Validate : func ( ) error { actionUsedList := [ ] bool { len ( runItem . Command ) != 0 , len ( runItem . SubTaskList ) != 0 , runItem . SetEnvironment != nil , } count := 0 for _ , isUsed := range actionUsedList { if isUsed { count ++ } } if count > 1 { return errors . New ( " " ) } return nil } , } return marshal . UnmarshalOneOf ( commandCandidate , runCandidate ) }
UnmarshalYAML allows simple commands to represent run structs.
UnmarshalYAML allows simple commands to represent run structs .
// Use new type to avoid recursion