diff --git a/taskfile/node_base.go b/taskfile/node_base.go index 57650d1afa..355b25c202 100644 --- a/taskfile/node_base.go +++ b/taskfile/node_base.go @@ -13,11 +13,11 @@ type ( } ) -func NewBaseNode(opts ...NodeOption) *BaseNode { +func NewBaseNode(dir string, opts ...NodeOption) *BaseNode { node := &BaseNode{ parent: nil, optional: false, - dir: "", + dir: dir, } // Apply options diff --git a/taskfile/node_file.go b/taskfile/node_file.go index 94557e6e59..38af717b83 100644 --- a/taskfile/node_file.go +++ b/taskfile/node_file.go @@ -20,12 +20,11 @@ type FileNode struct { func NewFileNode(l *logger.Logger, entrypoint, dir string, opts ...NodeOption) (*FileNode, error) { var err error - base := NewBaseNode(opts...) - entrypoint, dir, err = resolveFileNodeEntrypointAndDir(l, entrypoint, dir) + base := NewBaseNode(dir, opts...) + entrypoint, base.dir, err = resolveFileNodeEntrypointAndDir(l, entrypoint, base.dir) if err != nil { return nil, err } - base.dir = dir return &FileNode{ BaseNode: base, Entrypoint: entrypoint, diff --git a/taskfile/node_http.go b/taskfile/node_http.go index e32c4469e6..d7dce27b5c 100644 --- a/taskfile/node_http.go +++ b/taskfile/node_http.go @@ -20,8 +20,7 @@ type HTTPNode struct { } func NewHTTPNode(l *logger.Logger, entrypoint, dir string, insecure bool, opts ...NodeOption) (*HTTPNode, error) { - base := NewBaseNode(opts...) - base.dir = dir + base := NewBaseNode(dir, opts...) url, err := url.Parse(entrypoint) if err != nil { return nil, err diff --git a/taskfile/node_stdin.go b/taskfile/node_stdin.go index aa0e7a06df..04282b1fa2 100644 --- a/taskfile/node_stdin.go +++ b/taskfile/node_stdin.go @@ -17,10 +17,8 @@ type StdinNode struct { } func NewStdinNode(dir string) (*StdinNode, error) { - base := NewBaseNode() - base.dir = dir return &StdinNode{ - BaseNode: base, + BaseNode: NewBaseNode(dir), }, nil }