From cbb12b29bd30cfc779e59126fd607fa229497c3e Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Sun, 5 Apr 2020 11:08:49 -0300 Subject: [PATCH] v3: Fix bug where global vars were not being considered --- internal/taskfile/taskfile.go | 6 ++++++ internal/taskfile/var.go | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/taskfile/taskfile.go b/internal/taskfile/taskfile.go index b8cf5da9..fc6b1299 100644 --- a/internal/taskfile/taskfile.go +++ b/internal/taskfile/taskfile.go @@ -41,5 +41,11 @@ func (tf *Taskfile) UnmarshalYAML(unmarshal func(interface{}) error) error { if tf.Expansions <= 0 { tf.Expansions = 2 } + if tf.Vars == nil { + tf.Vars = &Vars{} + } + if tf.Env == nil { + tf.Env = &Vars{} + } return nil } diff --git a/internal/taskfile/var.go b/internal/taskfile/var.go index 99946f8a..2466e93c 100644 --- a/internal/taskfile/var.go +++ b/internal/taskfile/var.go @@ -50,9 +50,6 @@ func (vs *Vars) Merge(other *Vars) { // Set sets a value to a given key func (vs *Vars) Set(key string, value Var) { - if vs == nil { - vs = &Vars{} - } if vs.Mapping == nil { vs.Mapping = make(map[string]Var, 1) }