From 6420fc4911365cdfbf0d34eeca8ed8928d204432 Mon Sep 17 00:00:00 2001 From: jregan Date: Fri, 7 Aug 2020 13:21:35 -0700 Subject: [PATCH] Fix more constants. --- api/filters/fieldspec/fieldspec.go | 4 ++-- api/filters/refvar/refvar_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/filters/fieldspec/fieldspec.go b/api/filters/fieldspec/fieldspec.go index 6d6575702..6731cc403 100644 --- a/api/filters/fieldspec/fieldspec.go +++ b/api/filters/fieldspec/fieldspec.go @@ -86,7 +86,7 @@ func (fltr Filter) field(obj *yaml.RNode) error { // create the field if it is missing: must be a mapping node lookupField = yaml.LookupCreate(yaml.MappingNode, fieldName) kind = yaml.MappingNode - tag = "!!map" // TODO: change to yaml.NodeTagMap + tag = yaml.NodeTagMap } // locate (or maybe create) the field @@ -97,7 +97,7 @@ func (fltr Filter) field(obj *yaml.RNode) error { // if the value exists, but is null, then change it to the creation type // TODO: update yaml.LookupCreate to support this - if field.YNode().Tag == "!!null" { // TODO: change to yaml.NodeTagNull + if field.YNode().Tag == yaml.NodeTagNull { field.YNode().Kind = kind field.YNode().Tag = tag } diff --git a/api/filters/refvar/refvar_test.go b/api/filters/refvar/refvar_test.go index 10fedff0e..7603f2f86 100644 --- a/api/filters/refvar/refvar_test.go +++ b/api/filters/refvar/refvar_test.go @@ -8,6 +8,7 @@ import ( expansion2 "sigs.k8s.io/kustomize/api/internal/accumulator/expansion" filtertest_test "sigs.k8s.io/kustomize/api/testutils/filtertest" "sigs.k8s.io/kustomize/api/types" + "sigs.k8s.io/kustomize/kyaml/yaml" ) func TestFilter(t *testing.T) { @@ -251,7 +252,7 @@ metadata: config.kubernetes.io/index: '0' data: 1: str -' at path 'data': invalid map key: 1, type: !!int`, +' at path 'data': invalid map key: 1, type: ` + yaml.NodeTagInt, filter: Filter{ MappingFunc: expansion2.MappingFuncFor(replacementCounts, map[string]interface{}{ "VAR": int64(5),