mirror of
https://github.com/go-task/task.git
synced 2024-12-14 10:52:43 +02:00
feat: add ability to unmarshal as any when experiment enabled
This commit is contained in:
parent
5516ac1a00
commit
1cd26ae1b9
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
|
"github.com/go-task/task/v3/internal/experiments"
|
||||||
"github.com/go-task/task/v3/internal/orderedmap"
|
"github.com/go-task/task/v3/internal/orderedmap"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -78,6 +79,15 @@ type Var struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *Var) UnmarshalYAML(node *yaml.Node) error {
|
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 {
|
switch node.Kind {
|
||||||
|
|
||||||
case yaml.ScalarNode:
|
case yaml.ScalarNode:
|
||||||
|
Loading…
Reference in New Issue
Block a user