1
0
mirror of https://github.com/go-task/task.git synced 2024-12-12 10:45:49 +02:00

feat: add ability to unmarshal as any when experiment enabled

This commit is contained in:
Pete Davison 2023-11-29 16:24:56 +00:00
parent 5516ac1a00
commit 1cd26ae1b9

View File

@ -5,6 +5,7 @@ import (
"gopkg.in/yaml.v3"
"github.com/go-task/task/v3/internal/experiments"
"github.com/go-task/task/v3/internal/orderedmap"
)
@ -78,6 +79,15 @@ type Var struct {
}
func (v *Var) UnmarshalYAML(node *yaml.Node) error {
if experiments.AnyVariables {
var value any
if err := node.Decode(&value); err != nil {
return err
}
v.Value = value
return nil
}
switch node.Kind {
case yaml.ScalarNode: