1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

fix: nil pointer when version is omitted (#1149)

This commit is contained in:
Pete Davison
2023-05-02 16:51:39 +01:00
committed by GitHub
parent 50d6e057d5
commit 7ec5cac56b
2 changed files with 7 additions and 0 deletions

View File

@@ -6,6 +6,8 @@ import (
"github.com/Masterminds/semver/v3"
"gopkg.in/yaml.v3"
"github.com/go-task/task/v3/errors"
)
var (
@@ -71,6 +73,9 @@ func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
if tf.Expansions <= 0 {
tf.Expansions = 2
}
if tf.Version == nil {
return errors.New("task: 'version' is required")
}
if tf.Vars == nil {
tf.Vars = &Vars{}
}