1
0
mirror of https://github.com/go-task/task.git synced 2025-08-10 22:42:19 +02:00

feat: version checks

This commit is contained in:
Pete Davison
2024-01-11 22:30:02 +00:00
committed by Andrey Nering
parent 8c0236c795
commit e2b85c6aa1
5 changed files with 47 additions and 42 deletions

View File

@@ -6,8 +6,6 @@ import (
"github.com/Masterminds/semver/v3"
"gopkg.in/yaml.v3"
"github.com/go-task/task/v3/errors"
)
var V3 = semver.MustParse("3")
@@ -64,9 +62,6 @@ func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
tf.Dotenv = taskfile.Dotenv
tf.Run = taskfile.Run
tf.Interval = taskfile.Interval
if tf.Version == nil {
return errors.New("task: 'version' is required")
}
if tf.Vars == nil {
tf.Vars = &Vars{}
}

View File

@@ -45,7 +45,7 @@ func Read(
// Check that the Taskfile is set and has a schema version
if t == nil || t.Version == nil {
return nil, &errors.TaskfileVersionNotDefined{URI: node.Location()}
return nil, &errors.TaskfileVersionCheckError{URI: node.Location()}
}
// Annotate any included Taskfile reference with a base directory for resolving relative paths