return error for duplicate keys rather than panicking

This commit is contained in:
Natasha Sarkar
2021-03-03 12:03:36 -08:00
parent 93dd571df9
commit 722b0131f0
15 changed files with 86 additions and 31 deletions

View File

@@ -34,12 +34,16 @@ func (p *plugin) Transform(m resmap.ResMap) error {
return nil
}
for _, r := range m.Resources() {
if r.IsEmpty() {
empty, err := r.IsEmpty()
if err != nil {
return err
}
if empty {
// Don't mutate empty objects?
continue
}
r.StorePreviousId()
err := r.ApplyFilter(namespace.Filter{
err = r.ApplyFilter(namespace.Filter{
Namespace: p.Namespace,
FsSlice: p.FieldSpecs,
})