diff --git a/taskfile/node.go b/taskfile/node.go index 4aa22fa6..be20d13f 100644 --- a/taskfile/node.go +++ b/taskfile/node.go @@ -17,7 +17,6 @@ type Node interface { Parent() Node Location() string Dir() string - Optional() bool Remote() bool ResolveEntrypoint(entrypoint string) (string, error) ResolveDir(dir string) (string, error) diff --git a/taskfile/node_base.go b/taskfile/node_base.go index 355b25c2..8dd60f83 100644 --- a/taskfile/node_base.go +++ b/taskfile/node_base.go @@ -2,22 +2,20 @@ package taskfile type ( NodeOption func(*BaseNode) - // BaseNode is a generic node that implements the Parent() and Optional() - // methods of the NodeReader interface. It does not implement the Read() method - // and it designed to be embedded in other node types so that this boilerplate - // code does not need to be repeated. + // BaseNode is a generic node that implements the Parent() methods of the + // NodeReader interface. It does not implement the Read() method and it + // designed to be embedded in other node types so that this boilerplate code + // does not need to be repeated. BaseNode struct { - parent Node - optional bool - dir string + parent Node + dir string } ) func NewBaseNode(dir string, opts ...NodeOption) *BaseNode { node := &BaseNode{ - parent: nil, - optional: false, - dir: dir, + parent: nil, + dir: dir, } // Apply options @@ -38,16 +36,6 @@ func (node *BaseNode) Parent() Node { return node.parent } -func WithOptional(optional bool) NodeOption { - return func(node *BaseNode) { - node.optional = optional - } -} - -func (node *BaseNode) Optional() bool { - return node.optional -} - func (node *BaseNode) Dir() string { return node.dir } diff --git a/taskfile/reader.go b/taskfile/reader.go index 707c6562..724b269a 100644 --- a/taskfile/reader.go +++ b/taskfile/reader.go @@ -89,9 +89,6 @@ func (r *Reader) include(node Node) error { var err error vertex.Taskfile, err = r.readNode(node) if err != nil { - if node.Optional() { - return nil - } return err } @@ -129,9 +126,11 @@ func (r *Reader) include(node Node) error { includeNode, err := NewNode(r.logger, entrypoint, dir, r.insecure, r.timeout, WithParent(node), - WithOptional(include.Optional), ) if err != nil { + if include.Optional { + return nil + } return err }